def test_stereotype_inheritance_double_assignment(self): m = CMetaclass("M") t = CStereotype("T") try: CStereotype("S1", extended=m, superclasses=[t, t]) exception_expected_() except CException as e: eq_("'T' is already a superclass of 'S1'", e.value) s1 = m.get_stereotype("S1") eq_(s1.name, "S1") eq_(set(s1.superclasses), {t})
def test_get_stereotypes_by_name(self): m1 = CMetaclass() eq_(set(m1.get_stereotypes("S1")), set()) s1 = CStereotype("S1", extended=m1) eq_(m1.stereotypes, [s1]) eq_(set(m1.get_stereotypes("S1")), {s1}) s2 = CStereotype("S1", extended=m1) eq_(set(m1.get_stereotypes("S1")), {s1, s2}) ok_(s1 != s2) s3 = CStereotype("S1", extended=m1) eq_(set(m1.get_stereotypes("S1")), {s1, s2, s3}) eq_(m1.get_stereotype("S1"), s1)