def test_append(): DummyTab.reset() tabs = Tabs(h) dummy = DummyTab() tabs.append(dummy) assert tabs[0] is dummy assert tabs[0].nb == 0 assert tabs['dummy0'] is dummy assert tabs.by_class(DummyTab) == [dummy] dummy2 = DummyTab() tabs.append(dummy2) assert tabs[1] is dummy2 assert tabs[1].nb == 1 assert tabs['dummy1'] is dummy2 assert tabs.by_class(DummyTab) == [dummy, dummy2]
def test_delete(): DummyTab.reset() tabs = Tabs(h) dummy = DummyTab() dummy2 = DummyTab() tabs.append(dummy) tabs.append(dummy2) tabs.delete(dummy) assert tabs[0] is dummy2 assert tabs.by_class(DummyTab) == [dummy2] assert tabs['dummy0'] is None assert dummy2.nb == 0