This commit is contained in:
2026-06-24 19:55:31 -04:00
parent 734fdd9c46
commit 6296f45486

View File

@@ -1,6 +1,6 @@
import time import time
from untitled import content, model, persistence, rules from untitled import content, migration, model, persistence, rules
def test_save_load_roundtrip(tmp_path): def test_save_load_roundtrip(tmp_path):
@@ -28,23 +28,23 @@ def test_save_load_roundtrip(tmp_path):
assert loaded.version == content.SAVE_VERSION assert loaded.version == content.SAVE_VERSION
def test_migration(tmp_path): def test_migration():
cat = model.Save( v1 = {
version=1, "version": 1,
cat=model.Cat( "cat": {
"Fry", "name": "Fry",
{ "traits": {
"size": "tiny", "size": "tiny",
"color": "tuxedo", "color": "tuxedo",
"eyes": "blue", "eyes": "blue",
"personality": "judges you silently", "personality": "judges you silently",
}, },
), },
) }
persistence.save(cat, tmp_path) result = migration.migrate(v1)
loaded = persistence.load("Fry", tmp_path) assert result["version"] == 2
assert loaded.cat.fullness assert result["cat"]["fullness"] == 100
assert loaded.cat.last_updated assert "last_updated" in result["cat"]
def test_decay_and_feed(): def test_decay_and_feed():