diff options
Diffstat (limited to 'Lib/test/test_typing.py')
-rw-r--r-- | Lib/test/test_typing.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 6415273..08eddb0 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -2463,6 +2463,10 @@ class ForwardRefTests(BaseTestCase): fr = typing.ForwardRef('int') self.assertEqual(fr, typing.ForwardRef('int')) self.assertNotEqual(List['int'], List[int]) + self.assertNotEqual(fr, typing.ForwardRef('int', module=__name__)) + frm = typing.ForwardRef('int', module=__name__) + self.assertEqual(frm, typing.ForwardRef('int', module=__name__)) + self.assertNotEqual(frm, typing.ForwardRef('int', module='__other_name__')) def test_forward_equality_gth(self): c1 = typing.ForwardRef('C') @@ -2499,6 +2503,14 @@ class ForwardRefTests(BaseTestCase): self.assertEqual(hash(c1_gth), hash(c2_gth)) self.assertEqual(hash(c1), hash(c1_gth)) + c3 = typing.ForwardRef('int', module=__name__) + c4 = typing.ForwardRef('int', module='__other_name__') + + self.assertNotEqual(hash(c3), hash(c1)) + self.assertNotEqual(hash(c3), hash(c1_gth)) + self.assertNotEqual(hash(c3), hash(c4)) + self.assertEqual(hash(c3), hash(typing.ForwardRef('int', module=__name__))) + def test_forward_equality_namespace(self): class A: pass |