def test_decoy_creates_specless_async_spy(decoy: Decoy) -> None: """It should be able to create an async specless spy.""" subject = decoy.mock(is_async=True) assert isinstance(subject, AsyncSpy) # test deprecated create_decoy_func method subject = decoy.create_decoy_func(is_async=True) assert isinstance(subject, AsyncSpy)
def test_decoy_creates_func_spy(decoy: Decoy) -> None: """It should be able to create a Spy from a function.""" subject = decoy.mock(func=some_func) assert isinstance(subject, Spy) # test deprecated create_decoy_func method subject = decoy.create_decoy_func(spec=some_func) assert isinstance(subject, Spy)
def test_decoy_creates_specless_spy(decoy: Decoy) -> None: """It should be able to create a spec-less spy.""" subject = decoy.mock() assert isinstance(subject, Spy) # test deprecated create_decoy_func method subject = decoy.create_decoy_func() assert isinstance(subject, Spy) # test naming the spy subject = decoy.mock(name="spy_name") assert repr(subject) == "<Decoy mock `spy_name`>"