Skip to content

Commit

Permalink
Add isinstance tests for validation classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dangle committed Nov 27, 2017
1 parent 6922c1a commit 0e6c55b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 0e6c55b

Please sign in to comment.