def setup_method(self, method): self.w1 = DictionaryTreeBrowser() self.w2 = DictionaryTreeBrowser() for w in [self.w1, self.w2]: w.add_node('samf') self.samf = object() self.sl = StrategyList(self.samf)
def setUp(self): self.w1 = DictionaryTreeBrowser() self.w2 = DictionaryTreeBrowser() for w in [self.w1, self.w2]: w.add_node('samf') self.samf = object() self.sl = StrategyList(self.samf)
class TestStrategyList: def setup_method(self, method): self.w1 = DictionaryTreeBrowser() self.w2 = DictionaryTreeBrowser() for w in [self.w1, self.w2]: w.add_node('samf') self.samf = object() self.sl = StrategyList(self.samf) def test_append(self): assert not self.w1.samf is self.samf assert not self.w1 in self.sl self.sl.append(self.w1) assert self.w1.samf is self.samf assert self.w1 in self.sl def test_extend(self): self.sl.extend([self.w1, self.w2]) assert self.w1 in self.sl assert self.w1.samf is self.samf assert self.w2 in self.sl assert self.w2.samf is self.samf def test_remove_int(self): self.sl.append(self.w1) self.sl.remove(0) assert not self.w1.samf is self.samf assert not self.w1 in self.sl def test_remove_object(self): self.sl.append(self.w1) self.sl.remove(self.w1) assert not self.w1.samf is self.samf assert not self.w1 in self.sl
class TestStrategyList: def setUp(self): self.w1 = DictionaryTreeBrowser() self.w2 = DictionaryTreeBrowser() for w in [self.w1, self.w2]: w.add_node('samf') self.samf = object() self.sl = StrategyList(self.samf) def test_append(self): nt.assert_false(self.w1.samf is self.samf) nt.assert_false(self.w1 in self.sl) self.sl.append(self.w1) nt.assert_true(self.w1.samf is self.samf) nt.assert_true(self.w1 in self.sl) def test_extend(self): self.sl.extend([self.w1, self.w2]) nt.assert_true(self.w1 in self.sl) nt.assert_true(self.w1.samf is self.samf) nt.assert_true(self.w2 in self.sl) nt.assert_true(self.w2.samf is self.samf) def test_remove_int(self): self.sl.append(self.w1) self.sl.remove(0) nt.assert_false(self.w1.samf is self.samf) nt.assert_false(self.w1 in self.sl) def test_remove_object(self): self.sl.append(self.w1) self.sl.remove(self.w1) nt.assert_false(self.w1.samf is self.samf) nt.assert_false(self.w1 in self.sl)