From 0e6c55b952c93f3c8437888379e38a7df809b1bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Melissa=20Nu=C3=B1o?= Date: Sun, 26 Nov 2017 21:34:01 -0700 Subject: [PATCH] Add isinstance tests for validation classes. --- tests/test_types.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_types.py b/tests/test_types.py index 4a1bebe..1694568 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -109,3 +109,12 @@ class TestClass(object): with pytest.raises(TypeError): TestClass() + + +def test_isinstance(): + """Test that instances of sliced type are instances of validation type.""" + Age = typet.Bounded[int, 0:150] + assert isinstance(25, Age) is True + assert isinstance(-5, Age) is False + assert isinstance(200, Age) is False + assert isinstance('not an int', Age) is False