예제 #1
0
 def test_classifier_change_null_input(self):
     cl1 = CClass(self.mcl, "CL1")
     o1 = CObject(cl1, "O1")
     try:
         o1.classifier = None
         exception_expected_()
     except CException as e:
         eq_("'None' is not a class", e.value)
예제 #2
0
 def test_classifier_change_wrong_input_type(self):
     cl1 = CClass(self.mcl, "CL1")
     o1 = CObject(cl1, "O1")
     try:
         o1.classifier = self.mcl
         exception_expected_()
     except CException as e:
         ok_(e.value.endswith("' is not a class"))
예제 #3
0
 def test_classifier_change(self):
     cl1 = CClass(self.mcl, "CL1")
     cl2 = CClass(self.mcl, "CL2")
     o1 = CObject(cl1, "O1")
     o1.classifier = cl2
     eq_(o1.classifier, cl2)
     eq_(cl1.objects, [])
     eq_(cl2.objects, [o1])
예제 #4
0
 def test_class_is_deleted_in_classifier_method(self):
     c1 = CClass(self.mcl, "CL1")
     c2 = CClass(self.mcl, "CL2")
     o1 = CObject(c2, "O1")
     c1.delete()
     try:
         o1.classifier = c1
         exception_expected_()
     except CException as e:
         ok_(
             e.value.endswith(
                 "cannot access named element that has been deleted"))