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