Skip to content

Commit

Permalink
[3.10] gh-102444: Fix minor bugs in test_typing highlighted by pyfl…
Browse files Browse the repository at this point in the history
…akes (#102445) (#102452)

(cherry picked from commit 96e1022)
  • Loading branch information
AlexWaygood authored Mar 5, 2023
1 parent 9cec602 commit f5280e2
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4752,16 +4752,6 @@ class C:
self.assertEqual(get_type_hints(C, globals())['classvar'], ClassVar[int])
self.assertEqual(get_type_hints(C, globals())['const'], Final[int])

def test_hash_eq(self):
self.assertEqual(len({Annotated[int, 4, 5], Annotated[int, 4, 5]}), 1)
self.assertNotEqual(Annotated[int, 4, 5], Annotated[int, 5, 4])
self.assertNotEqual(Annotated[int, 4, 5], Annotated[str, 4, 5])
self.assertNotEqual(Annotated[int, 4], Annotated[int, 4, 4])
self.assertEqual(
{Annotated[int, 4, 5], Annotated[int, 4, 5], Annotated[T, 4, 5]},
{Annotated[int, 4, 5], Annotated[T, 4, 5]}
)

def test_cannot_subclass(self):
with self.assertRaisesRegex(TypeError, "Cannot subclass .*Annotated"):
class C(Annotated):
Expand Down Expand Up @@ -5309,7 +5299,7 @@ def test_special_attrs2(self):
self.assertEqual(fr.__module__, 'typing')
# Forward refs are currently unpicklable.
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
with self.assertRaises(TypeError) as exc:
with self.assertRaises(TypeError):
pickle.dumps(fr, proto)

self.assertEqual(SpecialAttrsTests.TypeName.__name__, 'TypeName')
Expand Down

0 comments on commit f5280e2

Please sign in to comment.