From 885e0419c4730f201c8b94436a2bae57d8e06849 Mon Sep 17 00:00:00 2001 From: Erez Shinan Date: Fri, 6 Oct 2023 12:02:05 +0300 Subject: [PATCH] Fix following PR #36 (reported by @KokeCacao) --- runtype/base_types.py | 6 ++++++ tests/test_basic.py | 1 + 2 files changed, 7 insertions(+) diff --git a/runtype/base_types.py b/runtype/base_types.py index 7cc3d10..902d88f 100644 --- a/runtype/base_types.py +++ b/runtype/base_types.py @@ -157,6 +157,12 @@ def __le__(self, other): return NotImplemented + def __ge__(self, other): + if isinstance(other, DataType): + return False + + return NotImplemented + class ContainerType(DataType): """Base class for containers, such as generics. diff --git a/tests/test_basic.py b/tests/test_basic.py index 06222c2..b93f1ff 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -70,6 +70,7 @@ def test_basic(self): assert isa((3,), (Tuple[int], list)) assert not isa([40, 2], Tuple[int, int]) + assert not issubclass(float, typing.Tuple[float, float]) # Mappings assert issubclass(dict, abc.Mapping)