Conversation
Update test fixtures to match current CueSpecs schema.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixture patchingRemoving field-level defaults from The fixtures were patched with the script below, then round-tripped through pooltool's own import msgpack
from pathlib import Path
from pooltool.system.datatypes import System
DEFAULTS = {
"brand": "Pooltool",
"M": 0.567,
"length": 1.4732,
"tip_radius": 0.0106045,
"shaft_radius_at_tip": 0.0065,
"shaft_radius_at_butt": 0.02,
"end_mass": 0.170097 / 30,
}
EXPECTED_KEYS = set(DEFAULTS.keys())
def patch_specs(specs: dict) -> bool:
changed = False
for k in list(specs.keys()):
if k not in EXPECTED_KEYS:
del specs[k]
changed = True
for k, v in DEFAULTS.items():
if k not in specs:
specs[k] = v
changed = True
return changed
def patch_fixture(path: Path) -> bool:
with open(path, "rb") as f:
data = msgpack.unpackb(f.read(), raw=False)
changed = patch_specs(data["cue"]["specs"])
if "events" in data:
for event in data["events"]:
if "agents" in event:
for agent in event["agents"]:
if isinstance(agent, dict):
for state_key in ("initial", "final"):
state = agent.get(state_key)
if isinstance(state, dict) and "specs" in state:
changed |= patch_specs(state["specs"])
if changed:
with open(path, "wb") as f:
f.write(msgpack.packb(data, use_bin_type=True))
return changed
tests_dir = Path("tests")
fixtures = sorted(tests_dir.rglob("*.msgpack"))
for p in fixtures:
patched = patch_fixture(p)
status = "Patched" if patched else "OK"
print(f"{status}: {p.relative_to(tests_dir)}")
print("\nRound-tripping through pooltool serializer...")
for p in fixtures:
s = System.load(p)
s.save(p)
print(f"Re-saved: {p.relative_to(tests_dir)}") |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #283 +/- ##
=======================================
Coverage 46.23% 46.23%
=======================================
Files 144 144
Lines 10287 10287
=======================================
Hits 4756 4756
Misses 5531 5531
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.