Skip to content

Commit

Permalink
Add example class test for UniqueList
Browse files Browse the repository at this point in the history
  • Loading branch information
JimMadge committed Apr 18, 2024
1 parent 7315aeb commit 9523e9c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/functions/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,24 @@ def test_validate_fqdn_fail(self, fqdn):
validate_fqdn(fqdn)


class MyClass:
def __init__(self, x):
self.x = x

def __eq__(self, other):
return self.x == other.x

def __hash__(self):
return hash(self.x)


class TestValidateUniqueList:
@pytest.mark.parametrize(
"items",
[
[1, 2, 3],
["a", 5, len],
[MyClass(x=1), MyClass(x=2)],
],
)
def test_validate_unique_list(self, items):
Expand All @@ -78,6 +90,7 @@ def test_validate_unique_list(self, items):
[DatabaseSystem.POSTGRESQL, 2, DatabaseSystem.POSTGRESQL],
[1, 1],
["abc", "abc"],
[MyClass(x=1), MyClass(x=1)],
],
)
def test_validate_unique_list_fail(self, items):
Expand Down

0 comments on commit 9523e9c

Please sign in to comment.