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.
This commit is contained in:
Daniel Watkins
2021-10-28 11:04:05 -04:00
committed by Jeong Yunwon
parent f6bf48a8f1
commit 2960ebc0d1

View File

@@ -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')