예제 #1
0
파일: Idea.py 프로젝트: klingerr/SoDocu
 def __config__(self):
     abstract_config = AbstractItem.__config__(self)
     meta_config = self.get_meta_data().__config__()
     relations_config = self.get_relations().__config__()
     config = merge_item_configs(abstract_config, meta_config)
     config = merge_item_configs(config, relations_config)
     return config        
예제 #2
0
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