adoption flow
This commit is contained in:
@@ -2,8 +2,25 @@ from untitled import model, persistence
|
|||||||
|
|
||||||
|
|
||||||
def test_save_load_roundtrip(tmp_path):
|
def test_save_load_roundtrip(tmp_path):
|
||||||
original = model.Save(version=1, cat=model.Cat("Mittens"))
|
original = model.Save(
|
||||||
|
version=1,
|
||||||
|
cat=model.Cat(
|
||||||
|
"Fry",
|
||||||
|
{
|
||||||
|
"size": "tiny",
|
||||||
|
"color": "tuxedo",
|
||||||
|
"eyes": "blue",
|
||||||
|
"personality": "judges you silently",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
persistence.save(original, tmp_path)
|
persistence.save(original, tmp_path)
|
||||||
loaded = persistence.load("Mittens", tmp_path)
|
loaded = persistence.load("Fry", tmp_path)
|
||||||
assert loaded.cat.name == "Mittens"
|
assert loaded.cat.name == "Fry"
|
||||||
|
assert loaded.cat.traits == {
|
||||||
|
"size": "tiny",
|
||||||
|
"color": "tuxedo",
|
||||||
|
"eyes": "blue",
|
||||||
|
"personality": "judges you silently",
|
||||||
|
}
|
||||||
assert loaded.version == 1
|
assert loaded.version == 1
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from untitled import generation, ui, rules, model
|
from untitled import generation, model, rules, ui
|
||||||
|
|
||||||
|
|
||||||
def adoption():
|
def adoption():
|
||||||
|
|||||||
Reference in New Issue
Block a user