def test_serialize(): c = Compartment( "infected", strat_names=["location", "age"], strat_values={ "location": "hawaii", "age": "15" }, ) assert c.serialize() == "infectedXlocation_hawaiiXage_15"
def test_stratify(): c = Compartment("infected") assert c._name == "infected" assert c._strat_names == tuple() assert c._strat_values == {} assert c.serialize() == "infected" c_age = c.stratify("age", "15") assert c_age._name == "infected" assert c_age._strat_names == ("age", ) assert c_age._strat_values == {"age": "15"} assert c_age.serialize() == "infectedXage_15" c_loc = c_age.stratify("location", "work") assert c_loc._name == "infected" assert c_loc._strat_names == ("age", "location") assert c_loc._strat_values == {"age": "15", "location": "work"} assert c_loc.serialize() == "infectedXage_15Xlocation_work"