def test_num_remaining(base_group): """When a table is modified It should alter self.remaining using count and capacity """ gr = base_group tab = Table() tab.add_group(gr) assert tab.remaining == 10 tab.remove_group(gr) assert tab.remaining == 12
def test_add_group_to_table(base_group): """When I add a group to a table It should add the group to groups It should add the count of the group to count """ gr = base_group tab1 = Table() tab1.add_group(gr) assert tab1.count == 2 assert tab1.groups[0] == gr
def test_overflow(): """When I try to add too many people to a table It should raise a ValueError """ gr = Group() gr.add_people(("", 13)) tab = Table() with pytest.raises(ValueError): tab.add_group(gr) assert tab.count == 0 assert len(tab.groups) == 0
def test_remove_group_from_table(base_group): """When I remove a group from the table It should remove the group from groups and it should decrement the count """ gr = base_group tab1 = Table() tab1.add_group(gr) tab1.remove_group(gr) assert tab1.count == 0 assert tab1.groups == []
def base_arrangement(): gr1 = Group(name="group 1") gr1.add_people(("Steve and Eli", 2)) gr2 = Group(name="group 2") tab1 = Table(name="table 1") tab1.add_group(gr1) tab2 = Table(name="table 2") arr = Arrangement() arr.unseated = [gr2] arr.tables = [tab1, tab2] return arr
def base_table(): gr = Group() gr.add_people(("Steve and Eli", 2)) tab = Table(name="Table 1") tab.add_group(gr) return tab