@@ -37,6 +37,9 @@ NON_REQUIRED_ACCOUNTS = {
TEST_KEY = 'invoice'
MISSING_MSG = f'{{}} missing {TEST_KEY}'.format
WRONG_TYPE_MSG = f'{{}} has wrong type of {TEST_KEY}: expected str but is a {{}}'.format
@pytest.fixture(scope='module')
def hook():
config = testutil.TestConfig()
@@ -77,13 +80,12 @@ def test_bad_type_values_on_postings(hook, acct1, acct2, value):
(acct2, -25),
(acct1, 25, {TEST_KEY: value}),
])
expected_msg = "{} has wrong type of {}: expected str but is a {}".format(
acct1,
TEST_KEY,
type(value).__name__,
)
expected = {
MISSING_MSG(acct1),
WRONG_TYPE_MSG(acct1, type(value).__name__),
}
actual = {error.message for error in hook.run(txn)}
assert actual == {expected_msg}
assert actual == expected
@pytest.mark.parametrize('acct1,acct2,value', testutil.combine_values(
REQUIRED_ACCOUNTS,
@@ -120,13 +122,12 @@ def test_bad_type_values_on_transaction(hook, acct1, acct2, value):
(acct1, 25),
@pytest.mark.parametrize('acct1,acct2', testutil.combine_values(