def test_household_to_dict_to_object(): chris = model.Person( last_name='Barker', first_name='Chris', middle_name='H', cell_phone='(123) 555-7890', email='*****@*****.**', ) fred = model.Person( last_name='Jones', first_name='Fred', middle_name='B', cell_phone='(123) 555-7890', email='*****@*****.**', ) home = model.Household( name="The Barkers", people=(chris, ), address=model.Address( line_1='123 Some St', line_2='Apt 1234', city='Seattle', state='WA', zip_code='98000', ), phone='123-456-8762', ) home2 = model.Household.from_dict(home.to_dict()) assert home2.name == home.name assert home2.phone == home.phone assert home2.address.line_1 == home.address.line_1 assert home2.address.line_2 == home.address.line_2 assert home2.people == home.people
def test_household_to_dict(): chris = model.Person( last_name='Barker', first_name='Chris', middle_name='H', cell_phone='(123) 555-7890', email='*****@*****.**', ) home = model.Household( name="The Barkers", people=(chris, ), address=model.Address( line_1='123 Some St', line_2='Apt 1234', city='Seattle', state='WA', zip_code='98000', ), phone='123-456-8762', ) home_dct = home.to_dict() assert home_dct['name'] == "The Barkers" assert home_dct['address']['city'] == 'Seattle'
def test_household_to_dict(chris): home = model.Household(name="The Barkers", people=(chris,), address=model.Address(line_1='123 Some St', line_2='Apt 1234', city='Seattle', state='WA', zip_code='98000',), phone='123-456-8762', ) home_dct = home.to_dict() assert home_dct['name'] == "The Barkers" assert home_dct['address']['city'] == 'Seattle'
def test_household_to_dict_to_object(chris, fred): home = model.Household(name="The Barkers", people=(chris, fred), address=model.Address(line_1='123 Some St', line_2='Apt 1234', city='Seattle', state='WA', zip_code='98000',), phone='123-456-8762', ) home2 = model.Household.from_dict(home.to_dict()) assert home2.name == home.name assert home2.phone == home.phone assert home2.address.line_1 == home.address.line_1 assert home2.address.line_2 == home.address.line_2 assert home2.people == home.people