class TestAbstractItem(unittest.TestCase): @classmethod def setUpClass(self): self.abstractItem = AbstractItem(None, 0, 'bla') @classmethod def tearDownClass(self): self.abstractItem = None def test_get_id(self): assert self.abstractItem.get_id() == 0 def test_get_name(self): assert self.abstractItem.get_name() == 'bla' def test_to_string(self): # print self.abst(ractItem assert self.abstractItem.__str__() == '[id=0, name=bla]' def test_to_config(self): config = self.abstractItem.__config__() section = "AbstractItem".lower() assert config.has_section(section) assert config.has_option(section, 'id') assert config.has_option(section, 'name') assert config.has_option(section, 'description') def test_equals(self): abstractItem2 = AbstractItem(None, 0, 'bla') assert abstractItem2 == self.abstractItem def test_not_equals(self): abstractItem2 = AbstractItem(None, 1, 'bla') assert abstractItem2 != self.abstractItem
def __str__(self): return 'Idea {' + AbstractItem.__str__(self) \ + self.get_meta_data().__str__() \ + self.get_relations().__str__() + '}'