def test_load_pickle_person(person_crop_last_act, tmpdir): path = os.path.join(tmpdir, 'test.pkl') person_crop_last_act.pickle(path) loaded = load_pickle(path) assert loaded.plan.day assert [a.act for a in loaded.plan.activities ] == [a.act for a in person_crop_last_act.plan.activities]
def test_load_pickle_household(person_crop_last_act, tmpdir): hh = Household('1') hh.add(person_crop_last_act) path = os.path.join(tmpdir, 'test.pkl') hh.pickle(path) loaded = load_pickle(path) assert loaded.people assert list(loaded.people['1'].attributes) == list( hh.people['1'].attributes)
def test_load_pickle_population(person_crop_last_act, tmpdir): population = Population() hh = Household('1') hh.add(person_crop_last_act) population.add(hh) path = os.path.join(tmpdir, 'test.pkl') population.pickle(path) loaded = load_pickle(path) assert loaded.households assert list(loaded.households['1'].people) == list( population.households['1'].people)