Skip to content

Commit

Permalink
fix: update now failing test
Browse files Browse the repository at this point in the history
Signed-off-by: F.N. Claessen <[email protected]>
  • Loading branch information
Flix6x committed Jul 17, 2024
1 parent 10f6527 commit 92660a0
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions timely_beliefs/tests/test_belief_persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,30 @@ def test_fail_adding_to_session(
session=session,
sensor=time_slot_sensor,
)
n_beliefs_before = len(bdf)

# Attempting to save the same data should fail, even if we expunge everything from the session
with pytest.raises(IntegrityError):
if bulk_save_objects:
# Attempting to save the same data should not yield new data in the database
DBTimedBelief.add_to_session(
session,
bdf,
expunge_session=True,
bulk_save_objects=bulk_save_objects,
commit_transaction=True,
)
bdf = DBTimedBelief.search_session(
session=session,
sensor=time_slot_sensor,
)
n_beliefs_after = len(bdf)
assert n_beliefs_after == n_beliefs_before
else:
# Attempting to save the same data should fail, even if we expunge everything from the session
with pytest.raises(IntegrityError):
DBTimedBelief.add_to_session(
session,
bdf,
expunge_session=True,
bulk_save_objects=bulk_save_objects,
commit_transaction=True,
)

0 comments on commit 92660a0

Please sign in to comment.