Finishing testing promises.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adsooi 2024-10-17 03:38:36 +02:00
parent ef465b34e7
commit a182c703f4
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
8 changed files with 114 additions and 36 deletions

View file

@ -21,7 +21,7 @@ from typing import Callable, Self
from .base import Assertion, repr_, AssertionInterface
from .int import NumberComparisonAssertionInterface
PRINT_PREFIX = (" " * 24)
PRINT_PREFIX = (" " * 3)
class SpyAssertion(Assertion):

View file

@ -30,4 +30,4 @@ class Spy:
def __call__(self, *args, **kwargs):
self.calls.append((args, kwargs))
if self.function is not None:
self.function(*args, **kwargs)
return self.function(*args, **kwargs)

View file

@ -134,13 +134,13 @@ def test_add_natural_complex():
assert that(2).equals.one.minus.two
def test_spy():
spy = Spy()
spy = Spy(lambda *args, **kw: 10)
assert that(spy).is_.an.instance_of(Spy)
assert that(spy).is_(callable)
# Check calls
assert that(spy).was.never.called
assert that(spy).was.called.zero.times
spy(30, arg="string")
assert spy(30, arg="string") == 10
assert that(spy).was.called
assert that(spy).was.called.once
assert that(spy).was.called.one.time
@ -159,7 +159,7 @@ def test_spy():
assert that(spy).was.called.with_no_argument()
def test_spy_seral_calls():
spy = Spy(lambda *args, **kw: None)
spy = Spy()
obj = object()
spy()
spy(30, arg="string")