Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix test_type_params
  • Loading branch information
JelleZijlstra committed May 17, 2023
commit 254e1cf8451b03647fc9d7cacf83508b96da8f99
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