python version of exercise

This commit is contained in:
Emily Bache
2019-08-07 08:47:07 +02:00
parent 358dab1c5b
commit cd583380f5
9 changed files with 190 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import json
import pytest
from approvaltests import verify
from approvaltests.utils import get_adjacent_file
from statement import statement
def test_example_statement():
with open(get_adjacent_file("invoice.json")) as f:
invoice = json.loads(f.read())
with open(get_adjacent_file("plays.json")) as f:
plays = json.loads(f.read())
verify(statement(invoice, plays))
def test_statement_with_new_play_types():
with open(get_adjacent_file("invoice_new_plays.json")) as f:
invoice = json.loads(f.read())
with open(get_adjacent_file("new_plays.json")) as f:
plays = json.loads(f.read())
with pytest.raises(ValueError) as exception_info:
statement(invoice, plays)
assert "unknown type" in str(exception_info.value)