Skip to content

Commit 41b1a9a

Browse files
committed
mark failing tests of test_types.py
1 parent d34e959 commit 41b1a9a

File tree

1 file changed

+91
-28
lines changed

1 file changed

+91
-28
lines changed

Lib/test/test_types.py

Lines changed: 91 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ def test_numeric_types(self):
8686
if float(1) == 1.0 and float(-1) == -1.0 and float(0) == 0.0: pass
8787
else: self.fail('float() does not work properly')
8888

89+
# TODO: RUSTPYTHON
90+
@unittest.expectedFailure
8991
def test_float_to_string(self):
9092
def test(f, result):
9193
self.assertEqual(f.__format__('e'), result)
@@ -206,6 +208,8 @@ def test_type_function(self):
206208
self.assertRaises(TypeError, type, 1, 2)
207209
self.assertRaises(TypeError, type, 1, 2, 3, 4)
208210

211+
# TODO: RUSTPYTHON
212+
@unittest.expectedFailure
209213
def test_int__format__(self):
210214
def test(i, format_spec, result):
211215
# just make sure we have the unified type for integers
@@ -375,6 +379,8 @@ def test(i, format_spec, result):
375379
test(123456, "1=20", '11111111111111123456')
376380
test(123456, "*=20", '**************123456')
377381

382+
# TODO: RUSTPYTHON
383+
@unittest.expectedFailure
378384
@run_with_locale('LC_NUMERIC', 'en_US.UTF8')
379385
def test_float__format__locale(self):
380386
# test locale support for __format__ code 'n'
@@ -384,6 +390,8 @@ def test_float__format__locale(self):
384390
self.assertEqual(locale.format_string('%g', x, grouping=True), format(x, 'n'))
385391
self.assertEqual(locale.format_string('%.10g', x, grouping=True), format(x, '.10n'))
386392

393+
# TODO: RUSTPYTHON
394+
@unittest.expectedFailure
387395
@run_with_locale('LC_NUMERIC', 'en_US.UTF8')
388396
def test_int__format__locale(self):
389397
# test locale support for __format__ code 'n' for integers
@@ -403,6 +411,8 @@ def test_int__format__locale(self):
403411
self.assertEqual(len(format(0, lfmt)), len(format(x, lfmt)))
404412
self.assertEqual(len(format(0, cfmt)), len(format(x, cfmt)))
405413

414+
# TODO: RUSTPYTHON
415+
@unittest.expectedFailure
406416
def test_float__format__(self):
407417
def test(f, format_spec, result):
408418
self.assertEqual(f.__format__(format_spec), result)
@@ -553,25 +563,29 @@ def test(f, format_spec, result):
553563
test(12345.6, "1=20", '111111111111112345.6')
554564
test(12345.6, "*=20", '*************12345.6')
555565

556-
def test_format_spec_errors(self):
557-
# int, float, and string all share the same format spec
558-
# mini-language parser.
566+
# TODO: RUSTPYTHON
567+
# @unittest.expectedFailure
568+
# def test_format_spec_errors(self):
569+
# # int, float, and string all share the same format spec
570+
# # mini-language parser.
559571

560-
# Check that we can't ask for too many digits. This is
561-
# probably a CPython specific test. It tries to put the width
562-
# into a C long.
563-
self.assertRaises(ValueError, format, 0, '1'*10000 + 'd')
572+
# # Check that we can't ask for too many digits. This is
573+
# # probably a CPython specific test. It tries to put the width
574+
# # into a C long.
575+
# self.assertRaises(ValueError, format, 0, '1'*10000 + 'd')
564576

565-
# Similar with the precision.
566-
self.assertRaises(ValueError, format, 0, '.' + '1'*10000 + 'd')
577+
# # Similar with the precision.
578+
# self.assertRaises(ValueError, format, 0, '.' + '1'*10000 + 'd')
567579

568-
# And may as well test both.
569-
self.assertRaises(ValueError, format, 0, '1'*1000 + '.' + '1'*10000 + 'd')
580+
# # And may as well test both.
581+
# self.assertRaises(ValueError, format, 0, '1'*1000 + '.' + '1'*10000 + 'd')
570582

571-
# Make sure commas aren't allowed with various type codes
572-
for code in 'xXobns':
573-
self.assertRaises(ValueError, format, 0, ',' + code)
583+
# # Make sure commas aren't allowed with various type codes
584+
# for code in 'xXobns':
585+
# self.assertRaises(ValueError, format, 0, ',' + code)
574586

587+
# TODO: RUSTPYTHON
588+
@unittest.expectedFailure
575589
def test_internal_sizes(self):
576590
self.assertGreater(object.__basicsize__, 0)
577591
self.assertGreater(tuple.__itemsize__, 0)
@@ -588,6 +602,8 @@ def test_method_wrapper_types(self):
588602
self.assertIsInstance(object().__lt__, types.MethodWrapperType)
589603
self.assertIsInstance((42).__lt__, types.MethodWrapperType)
590604

605+
# TODO: RUSTPYTHON
606+
@unittest.expectedFailure
591607
def test_method_descriptor_types(self):
592608
self.assertIsInstance(str.join, types.MethodDescriptorType)
593609
self.assertIsInstance(list.append, types.MethodDescriptorType)
@@ -602,6 +618,8 @@ def test_method_descriptor_types(self):
602618
class MappingProxyTests(unittest.TestCase):
603619
mappingproxy = types.MappingProxyType
604620

621+
# TODO: RUSTPYTHON
622+
@unittest.expectedFailure
605623
def test_constructor(self):
606624
class userdict(dict):
607625
pass
@@ -617,6 +635,8 @@ class userdict(dict):
617635
self.assertRaises(TypeError, self.mappingproxy, ("a", "tuple"))
618636
self.assertRaises(TypeError, self.mappingproxy, ["a", "list"])
619637

638+
# TODO: RUSTPYTHON
639+
@unittest.expectedFailure
620640
def test_methods(self):
621641
attrs = set(dir(self.mappingproxy({}))) - set(dir(object()))
622642
self.assertEqual(attrs, {
@@ -640,6 +660,8 @@ def test_get(self):
640660
self.assertIsNone(view.get('xxx'))
641661
self.assertEqual(view.get('xxx', 42), 42)
642662

663+
# TODO: RUSTPYTHON
664+
@unittest.expectedFailure
643665
def test_missing(self):
644666
class dictmissing(dict):
645667
def __missing__(self, key):
@@ -654,6 +676,8 @@ def __missing__(self, key):
654676
self.assertTrue('x' in view)
655677
self.assertFalse('y' in view)
656678

679+
# TODO: RUSTPYTHON
680+
@unittest.expectedFailure
657681
def test_customdict(self):
658682
class customdict(dict):
659683
def __contains__(self, key):
@@ -702,6 +726,8 @@ def get(self, key, default=None):
702726
self.assertEqual(view.keys(), 'keys')
703727
self.assertEqual(view.values(), 'values')
704728

729+
# TODO: RUSTPYTHON
730+
@unittest.expectedFailure
705731
def test_chainmap(self):
706732
d1 = {'x': 1}
707733
d2 = {'y': 2}
@@ -747,6 +773,8 @@ def test_views(self):
747773
self.assertEqual(list(values), ['value'])
748774
self.assertEqual(list(items), [('key', 'value')])
749775

776+
# TODO: RUSTPYTHON
777+
@unittest.expectedFailure
750778
def test_len(self):
751779
for expected in range(6):
752780
data = dict.fromkeys('abcde'[:expected])
@@ -764,6 +792,8 @@ def test_iterators(self):
764792
self.assertEqual(set(view.values()), set(values))
765793
self.assertEqual(set(view.items()), set(items))
766794

795+
# TODO: RUSTPYTHON
796+
@unittest.expectedFailure
767797
def test_copy(self):
768798
original = {'key1': 27, 'key2': 51, 'key3': 93}
769799
view = self.mappingproxy(original)
@@ -799,6 +829,8 @@ def test_new_class_subclass(self):
799829
C = types.new_class("C", (int,))
800830
self.assertTrue(issubclass(C, int))
801831

832+
# TODO: RUSTPYTHON
833+
@unittest.expectedFailure
802834
def test_new_class_meta(self):
803835
Meta = self.Meta
804836
settings = {"metaclass": Meta, "z": 2}
@@ -809,6 +841,8 @@ def test_new_class_meta(self):
809841
self.assertEqual(C.y, 1)
810842
self.assertEqual(C.z, 2)
811843

844+
# TODO: RUSTPYTHON
845+
@unittest.expectedFailure
812846
def test_new_class_exec_body(self):
813847
Meta = self.Meta
814848
def func(ns):
@@ -834,6 +868,8 @@ def test_new_class_defaults(self):
834868
self.assertEqual(C.__name__, "C")
835869
self.assertEqual(C.__bases__, (object,))
836870

871+
# TODO: RUSTPYTHON
872+
@unittest.expectedFailure
837873
def test_new_class_meta_with_base(self):
838874
Meta = self.Meta
839875
def func(ns):
@@ -930,6 +966,8 @@ def __prepare__(*args):
930966
self.assertIs(ns, expected_ns)
931967
self.assertEqual(len(kwds), 0)
932968

969+
# TODO: RUSTPYTHON
970+
@unittest.expectedFailure
933971
def test_bad___prepare__(self):
934972
# __prepare__() must return a mapping.
935973
class BadMeta(type):
@@ -974,6 +1012,8 @@ def __mro_entries__(self, bases):
9741012
for bases in [x, y, z, t]:
9751013
self.assertIs(types.resolve_bases(bases), bases)
9761014

1015+
# TODO: RUSTPYTHON
1016+
@unittest.expectedFailure
9771017
def test_metaclass_derivation(self):
9781018
# issue1294232: correct metaclass calculation
9791019
new_calls = [] # to check the order of __new__ calls
@@ -1028,6 +1068,8 @@ def __prepare__(mcls, name, bases):
10281068
new_calls.clear()
10291069
self.assertIn('BMeta_was_here', E.__dict__)
10301070

1071+
# TODO: RUSTPYTHON
1072+
@unittest.expectedFailure
10311073
def test_metaclass_override_function(self):
10321074
# Special case: the given metaclass isn't a class,
10331075
# so there is no metaclass calculation.
@@ -1129,6 +1171,8 @@ def __prepare__(mcls, name, bases):
11291171
with self.assertRaises(TypeError):
11301172
X = types.new_class("X", (int(), C))
11311173

1174+
# TODO: RUSTPYTHON
1175+
@unittest.expectedFailure
11321176
def test_one_argument_type(self):
11331177
expected_message = 'type.__new__() takes exactly 3 arguments (1 given)'
11341178

@@ -1150,22 +1194,23 @@ class N(type, metaclass=M):
11501194

11511195
class SimpleNamespaceTests(unittest.TestCase):
11521196

1153-
def test_constructor(self):
1154-
ns1 = types.SimpleNamespace()
1155-
ns2 = types.SimpleNamespace(x=1, y=2)
1156-
ns3 = types.SimpleNamespace(**dict(x=1, y=2))
1197+
# TODO: RUSTPYTHON
1198+
# def test_constructor(self):
1199+
# ns1 = types.SimpleNamespace()
1200+
# ns2 = types.SimpleNamespace(x=1, y=2)
1201+
# ns3 = types.SimpleNamespace(**dict(x=1, y=2))
11571202

1158-
with self.assertRaises(TypeError):
1159-
types.SimpleNamespace(1, 2, 3)
1160-
with self.assertRaises(TypeError):
1161-
types.SimpleNamespace(**{1: 2})
1203+
# with self.assertRaises(TypeError):
1204+
# types.SimpleNamespace(1, 2, 3)
1205+
# with self.assertRaises(TypeError):
1206+
# types.SimpleNamespace(**{1: 2})
11621207

1163-
self.assertEqual(len(ns1.__dict__), 0)
1164-
self.assertEqual(vars(ns1), {})
1165-
self.assertEqual(len(ns2.__dict__), 2)
1166-
self.assertEqual(vars(ns2), {'y': 2, 'x': 1})
1167-
self.assertEqual(len(ns3.__dict__), 2)
1168-
self.assertEqual(vars(ns3), {'y': 2, 'x': 1})
1208+
# self.assertEqual(len(ns1.__dict__), 0)
1209+
# self.assertEqual(vars(ns1), {})
1210+
# self.assertEqual(len(ns2.__dict__), 2)
1211+
# self.assertEqual(vars(ns2), {'y': 2, 'x': 1})
1212+
# self.assertEqual(len(ns3.__dict__), 2)
1213+
# self.assertEqual(vars(ns3), {'y': 2, 'x': 1})
11691214

11701215
def test_unbound(self):
11711216
ns1 = vars(types.SimpleNamespace())
@@ -1205,6 +1250,8 @@ def test_attrset(self):
12051250
self.assertEqual(ns1.__dict__, dict(a='spam', b='ham'))
12061251
self.assertEqual(ns2.__dict__, dict(x=1, y=2, w=3, z=4, theta=None))
12071252

1253+
# TODO: RUSTPYTHON
1254+
@unittest.expectedFailure
12081255
def test_attrdel(self):
12091256
ns1 = types.SimpleNamespace()
12101257
ns2 = types.SimpleNamespace(x=1, y=2, w=3)
@@ -1226,6 +1273,8 @@ def test_attrdel(self):
12261273
del ns1.spam
12271274
self.assertEqual(vars(ns1), {})
12281275

1276+
# TODO: RUSTPYTHON
1277+
@unittest.expectedFailure
12291278
def test_repr(self):
12301279
ns1 = types.SimpleNamespace(x=1, y=2, w=3)
12311280
ns2 = types.SimpleNamespace()
@@ -1236,6 +1285,8 @@ def test_repr(self):
12361285
self.assertEqual(repr(ns1), "{name}(w=3, x=1, y=2)".format(name=name))
12371286
self.assertEqual(repr(ns2), "{name}(_y=5, x='spam')".format(name=name))
12381287

1288+
# TODO: RUSTPYTHON
1289+
@unittest.expectedFailure
12391290
def test_equal(self):
12401291
ns1 = types.SimpleNamespace(x=1)
12411292
ns2 = types.SimpleNamespace()
@@ -1274,6 +1325,8 @@ def test_recursive(self):
12741325
self.assertEqual(ns3.spam, ns2)
12751326
self.assertEqual(ns2.spam.spam, ns2)
12761327

1328+
# TODO: RUSTPYTHON
1329+
@unittest.expectedFailure
12771330
def test_recursive_repr(self):
12781331
ns1 = types.SimpleNamespace(c='cookie')
12791332
ns2 = types.SimpleNamespace()
@@ -1309,6 +1362,8 @@ class Spam(types.SimpleNamespace):
13091362
self.assertIs(type(spam), Spam)
13101363
self.assertEqual(vars(spam), {'ham': 8, 'eggs': 9})
13111364

1365+
# TODO: RUSTPYTHON
1366+
@unittest.expectedFailure
13121367
def test_pickle(self):
13131368
ns = types.SimpleNamespace(breakfast="spam", lunch="spam")
13141369

@@ -1366,6 +1421,8 @@ def foo():
13661421
foo = types.coroutine(foo)
13671422
self.assertIs(aw, foo())
13681423

1424+
# TODO: RUSTPYTHON
1425+
@unittest.expectedFailure
13691426
def test_async_def(self):
13701427
# Test that types.coroutine passes 'async def' coroutines
13711428
# without modification
@@ -1417,6 +1474,8 @@ def foo():
14171474
self.assertIs(foo(), coro)
14181475
self.assertIs(foo().__await__(), coro)
14191476

1477+
# TODO: RUSTPYTHON
1478+
@unittest.expectedFailure
14201479
def test_duck_gen(self):
14211480
class GenLike:
14221481
def send(self): pass
@@ -1573,6 +1632,8 @@ async def corofunc():
15731632
else:
15741633
self.fail('StopIteration was expected')
15751634

1635+
# TODO: RUSTPYTHON
1636+
@unittest.expectedFailure
15761637
def test_gen(self):
15771638
def gen_func():
15781639
yield 1
@@ -1622,6 +1683,8 @@ def foo():
16221683
foo = types.coroutine(foo)
16231684
self.assertIs(foo(), gencoro)
16241685

1686+
# TODO: RUSTPYTHON
1687+
@unittest.expectedFailure
16251688
def test_genfunc(self):
16261689
def gen(): yield
16271690
self.assertIs(types.coroutine(gen), gen)

0 commit comments

Comments
 (0)