From 2960ebc0d1643e5215cd999c8982c45fbd191eed Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Thu, 28 Oct 2021 11:04:05 -0400 Subject: [PATCH] test/test_builtin.py: run most of test_type_name The remaining failures are due to what appears to be a fundamental difference between how RustPython and CPython handle surrogate characters/codepoints-which-aren't-characters. They are wrapped with `self.assertRaises(AssertionError)` so we will notice once they start passing. https://github.com/RustPython/RustPython/issues/935 is most likely related. --- Lib/test/test_builtin.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 70221eb8d..2bd69b759 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -2052,8 +2052,6 @@ class TestType(unittest.TestCase): with self.assertRaises(TypeError): type('a', (), dict={}) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_type_name(self): for name in 'A', '\xc4', '\U0001f40d', 'B.A', '42', '': with self.subTest(name=name): @@ -2063,8 +2061,10 @@ class TestType(unittest.TestCase): self.assertEqual(A.__module__, __name__) with self.assertRaises(ValueError): type('A\x00B', (), {}) - with self.assertRaises(ValueError): - type('A\udcdcB', (), {}) + # TODO: RUSTPYTHON (https://github.com/RustPython/RustPython/issues/935) + with self.assertRaises(AssertionError): + with self.assertRaises(ValueError): + type('A\udcdcB', (), {}) with self.assertRaises(TypeError): type(b'A', (), {}) @@ -2080,9 +2080,13 @@ class TestType(unittest.TestCase): with self.assertRaises(ValueError): A.__name__ = 'A\x00B' self.assertEqual(A.__name__, 'C') - with self.assertRaises(ValueError): - A.__name__ = 'A\udcdcB' - self.assertEqual(A.__name__, 'C') + # TODO: RUSTPYTHON (https://github.com/RustPython/RustPython/issues/935) + with self.assertRaises(AssertionError): + with self.assertRaises(ValueError): + A.__name__ = 'A\udcdcB' + self.assertEqual(A.__name__, 'C') + # TODO: RUSTPYTHON: the previous __name__ set should fail but doesn't: reset it + A.__name__ = 'C' with self.assertRaises(TypeError): A.__name__ = b'A' self.assertEqual(A.__name__, 'C')