Skip to content

Commit

Permalink
Assert on exact error message, refs #537
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed May 8, 2023
1 parent 39ef137 commit 923768d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,13 @@ def test_create_error_if_invalid_foreign_keys(fresh_db):


def test_create_error_if_invalid_self_referential_foreign_keys(fresh_db):
with pytest.raises(AlterError):
with pytest.raises(AlterError) as ex:
fresh_db["one"].insert(
{"id": 1, "ref_id": 3},
pk="id",
foreign_keys=(("ref_id", "one", "bad_column"),),
)
assert ex.value.args == ("No such column: one.bad_column",)


@pytest.mark.parametrize(
Expand Down

0 comments on commit 923768d

Please sign in to comment.