Skip to content

Commit

Permalink
Fix test_type_params
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed May 17, 2023
1 parent a3f7db7 commit 254e1cf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Lib/test/test_type_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,11 @@ class Foo[T: Foo, U: (Foo, Foo)]:
type_params = Foo.__type_params__
self.assertEqual(len(type_params), 2)
self.assertEqual(type_params[0].__name__, "T")
self.assertEqual(type_params[0].__bound__, Foo)
self.assertEqual(type_params[0].__constraints__, None)
self.assertIs(type_params[0].__bound__, Foo)
self.assertEqual(type_params[0].__constraints__, ())

self.assertEqual(type_params[1].__name__, "U")
self.assertEqual(type_params[1].__bound__, None)
self.assertIs(type_params[1].__bound__, None)
self.assertEqual(type_params[1].__constraints__, (Foo, Foo))

def test_evaluation_error(self):
Expand All @@ -439,16 +439,16 @@ class Foo[T: Undefined, U: (Undefined,)]:
type_params = Foo.__type_params__
with self.assertRaises(NameError):
type_params[0].__bound__
self.assertEqual(type_params[0].__constraints__, None)
self.assertEqual(type_params[1].__bound__, None)
self.assertEqual(type_params[0].__constraints__, ())
self.assertIs(type_params[1].__bound__, None)
with self.assertRaises(NameError):
type_params[1].__constraints__

Undefined = "defined"
self.assertEqual(type_params[0].__bound__, "defined")
self.assertEqual(type_params[0].__constraints__, None)
self.assertEqual(type_params[0].__constraints__, ())

self.assertEqual(type_params[1].__bound__, None)
self.assertIs(type_params[1].__bound__, None)
self.assertEqual(type_params[1].__constraints__, ("defined",))


Expand Down

0 comments on commit 254e1cf

Please sign in to comment.