Exemple #1
0
 def test_should_find_components_with_same_attributes_in_list(self):
     componentinstance = ComponentModel(FakeObj, [], LifeStyle.transient())
     componentinstance2nd = ComponentModel(FakeObj, [],
                                           LifeStyle.transient())
     componentset = ComponentSet()
     componentset.add(componentinstance)
     assert componentset.has_comp(componentinstance2nd)
Exemple #2
0
 def test_should_prevent_storing_duplicate_attributes_of_componentmodel(self):
     componentset = ComponentSet()
     componentinstance = ComponentModel(FakeObj, [], LifeStyle.transient())
     componentinstance2nd = ComponentModel(FakeObj, [], LifeStyle.transient())
     componentset.add(componentinstance)
     try:
         componentset.add(componentinstance2nd)
         self.fail("should not happen")
     except AttemptToAddDuplicateComponentModelToVisitedSet:
         pass
Exemple #3
0
 def test_should_prevent_storing_duplicate_attributes_of_componentmodel(
         self):
     componentset = ComponentSet()
     componentinstance = ComponentModel(FakeObj, [], LifeStyle.transient())
     componentinstance2nd = ComponentModel(FakeObj, [],
                                           LifeStyle.transient())
     componentset.add(componentinstance)
     try:
         componentset.add(componentinstance2nd)
         self.fail("should not happen")
     except AttemptToAddDuplicateComponentModelToVisitedSet:
         pass
Exemple #4
0
 def test_should_find_components_with_same_attributes_in_list(self):
     componentinstance = ComponentModel(FakeObj, [], LifeStyle.transient())
     componentinstance2nd = ComponentModel(FakeObj, [], LifeStyle.transient())
     componentset = ComponentSet()
     componentset.add(componentinstance)
     assert componentset.has_comp(componentinstance2nd)
Exemple #5
0
 def resolve(self, clstype=None, key=None):
     """standard client way of accessing Components"""
     visitedset = ComponentSet()
     obj = self.__resolver.recursewalk(self.__objectgraph, key, clstype,
                                       self.__instances, visitedset)
     return obj