didier/tests/test_didier/test_exceptions/test_no_match.py

16 lines
444 B
Python
Raw Normal View History

2022-09-03 01:26:32 +02:00
import pytest
from didier.exceptions import NoMatch, expect
def test_expect_none_raises():
"""Test that expect() raises an error if the input entity is None"""
with pytest.raises(NoMatch):
expect(None, entity_type="", argument="")
def test_expect_not_none_returns():
"""Test that expect() returns the argument if it isn't None"""
arg = "Some input string"
assert expect(arg, entity_type="", argument="") == arg