Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-rp committed Feb 6, 2024
1 parent 9930ad6 commit 678d187
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions tests/common/test_versioned_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@ def test_versioned_state() -> None:
assert state["_state_version"] == 0
assert state["_state_engine_version"] == 1

# first hash generation does not change version, attrs are not modified
version, hash, previous_hash = bump_state_version_if_modified(state)
# first hash_ generation does not change version, attrs are not modified
version, hash_, previous_hash = bump_state_version_if_modified(state)
assert version == 0
assert hash is not None
assert hash_ is not None
assert previous_hash is None
assert state["_version_hash"] == hash
assert state["_version_hash"] == hash_

# change attr, but exclude while generating
state["foo"] = "bar" # type: ignore
version, hash, previous_hash = bump_state_version_if_modified(state, exclude_attrs=["foo"])
version, hash_, previous_hash = bump_state_version_if_modified(state, exclude_attrs=["foo"])
assert version == 0
assert hash == previous_hash
assert hash_ == previous_hash

# now don't exclude (remember old hash to compare return vars)
# now don't exclude (remember old hash_ to compare return vars)
old_hash = state["_version_hash"]
version, hash, previous_hash = bump_state_version_if_modified(state)
version, hash_, previous_hash = bump_state_version_if_modified(state)
assert version == 1
assert hash != previous_hash
assert old_hash != hash
assert hash_ != previous_hash
assert old_hash != hash_
assert previous_hash == old_hash

# messing with state engine version will not change hash
# messing with state engine version will not change hash_
state["_state_engine_version"] = 5
version, hash, previous_hash = bump_state_version_if_modified(state)
version, hash_, previous_hash = bump_state_version_if_modified(state)
assert version == 1
assert hash == previous_hash
assert hash_ == previous_hash

# make sure state object is not modified while bumping with no effect
old_state = state.copy()
version, hash, previous_hash = bump_state_version_if_modified(state)
version, hash_, previous_hash = bump_state_version_if_modified(state)
assert old_state == state

0 comments on commit 678d187

Please sign in to comment.