diff --git a/runtype/base_types.py b/runtype/base_types.py index 902d88f..2c00310 100644 --- a/runtype/base_types.py +++ b/runtype/base_types.py @@ -208,7 +208,7 @@ def __eq__(self, other): def __le__(self, other): - if isinstance(other, type(self)): + if isinstance(other, GenericType): return self.base <= other.base and self.item <= other.item elif isinstance(other, DataType): diff --git a/tests/test_basic.py b/tests/test_basic.py index b93f1ff..9b91229 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -144,6 +144,9 @@ def test_tuple_ellipsis(self): assert_isa((1,2,3), Tuple[int, ...]) self.assertRaises(TypeError, assert_isa, (1, "2"), Tuple[int, ...]) + assert issubclass(Tuple[str, ...], typing.Sequence[str]) + assert not issubclass(Tuple[str, ...], typing.Sequence[int]) + @unittest.skipIf(sys.version_info < (3, 8), "Not supported before Python 3.8") def test_py38(self): assert isa('a', typing.Literal['a', 'b'])