Skip to content

Commit

Permalink
Update test_check.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-morel committed Jun 5, 2024
1 parent 49da092 commit 2633922
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/tests/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ def __init__(self: Any, bar: Checks(func=bool)) -> Any:
pass


@Check.register('test1 test2')
def test(param, val):
print(param, val)


class IsInt(Check):
name = 'isint'

def __call__(self, a, b):
return a == isinstance(b, int)


def test_check():
try:
foo(0)
Expand All @@ -36,14 +48,17 @@ def test_check():
else:
raise Exception()

@Check.register('test1 test2')
def test(param, val):
print(param, val)
Checks(test1=3)(3)
Checks(test2=4)(4)
Checks(ge=2, gt=1, lt=2.1, le=2, eq=2)(2)
Checks(ge=-2.5, gt=-3, lt=-2, le=2, eq=-2.5)(-2.5)
Checks(len=(2, 5))('abcd')
Checks(type=dict[str|int, tuple[int]])({
'#': (12,),
20: (21, 45),
})
Checks(isinstance=float)(1.5)
Checks(isint=True)(5)


if __name__ == '__main__':
Expand Down

0 comments on commit 2633922

Please sign in to comment.