def test_delete_class_from_bundle(self):
        b1 = CBundle("B1")
        cl1 = CClass(self.mcl, "CL1", bundles=b1)
        cl1.delete()
        eq_(set(b1.get_elements(type=CClass)), set())

        cl1 = CClass(self.mcl, "CL1", bundles=b1)
        cl2 = CClass(self.mcl, "CL2", bundles=b1)
        cl3 = CClass(self.mcl,
                     "CL3",
                     superclasses=cl2,
                     attributes={"i": 1},
                     bundles=b1)
        cl3.set_value("i", 7)
        CObject(cl3, bundles=b1)
        cl1.delete()
        eq_(set(b1.get_elements(type=CClass)), {cl2, cl3})
        cl3.delete()
        eq_(set(b1.get_elements(type=CClass)), {cl2})

        eq_(cl3.superclasses, [])
        eq_(cl2.subclasses, [])
        eq_(cl3.attributes, [])
        eq_(cl3.attribute_names, [])
        eq_(cl3.metaclass, None)
        eq_(cl3.objects, [])
        eq_(cl3.name, None)
        eq_(cl3.bundles, [])
        eq_(b1.get_elements(type=CObject), [])
        try:
            cl3.get_value("i")
            exception_expected_()
        except CException as e:
            eq_("can't get value 'i' on deleted class", e.value)
예제 #2
0
 def test_delete_bundle_from_two_bundles(self):
     b1 = CBundle("B1")
     b2 = CBundle("B2")
     e1 = CEnum("e1", bundles=[b1, b2])
     b1.delete()
     eq_(set(b1.get_elements(type=CEnum)), set())
     eq_(set(b2.get_elements(type=CEnum)), {e1})
     eq_(set(e1.bundles), {b2})
예제 #3
0
 def test_delete_bundle_from_two_bundles(self):
     b1 = CBundle("B1")
     b2 = CBundle("B2")
     s1 = CStereotype("s1", bundles=[b1, b2])
     b1.delete()
     eq_(set(b1.get_elements(type=CStereotype)), set())
     eq_(set(b2.get_elements(type=CStereotype)), {s1})
     eq_(set(s1.bundles), {b2})
 def test_delete_bundle_from_two_bundles(self):
     b1 = CBundle("B1")
     b2 = CBundle("B2")
     c1 = CClass(self.mcl, "c1", bundles=[b1, b2])
     b1.delete()
     eq_(set(b1.get_elements(type=CClass)), set())
     eq_(set(b2.get_elements(type=CClass)), {c1})
     eq_(set(c1.bundles), {b2})
 def test_delete_bundle_from_two_bundles(self):
     b1 = CBundle("B1")
     b2 = CBundle("B2")
     ba = CBundle("ba", bundles=[b1, b2])
     b1.delete()
     eq_(set(b1.get_elements(type=CBundle)), set())
     eq_(set(b2.get_elements(type=CBundle)), {ba})
     eq_(set(ba.bundles), {b2})
 def test_delete_bundle_from_two_bundles(self):
     b1 = CBundle("B1")
     b2 = CBundle("B2")
     m1 = CMetaclass("m1", bundles=[b1, b2])
     b1.delete()
     eq_(set(b1.get_elements(type=CMetaclass)), set())
     eq_(set(b2.get_elements(type=CMetaclass)), {m1})
     eq_(set(m1.bundles), {b2})
    def test_remove_class_from_bundle(self):
        b1 = CBundle("B1")
        b2 = CBundle("B2")
        cl1 = CClass(self.mcl, "CL1", bundles=b1)
        try:
            # noinspection PyTypeChecker
            b1.remove(None)
            exception_expected_()
        except CException as e:
            eq_("'None' is not an element of the bundle", e.value)
        try:
            b1.remove(CEnum("A"))
            exception_expected_()
        except CException as e:
            eq_("'A' is not an element of the bundle", e.value)
        try:
            b2.remove(cl1)
            exception_expected_()
        except CException as e:
            eq_("'CL1' is not an element of the bundle", e.value)
        b1.remove(cl1)
        eq_(set(b1.get_elements(type=CClass)), set())

        cl1 = CClass(self.mcl, "CL1", bundles=b1)
        cl2 = CClass(self.mcl, "CL2", bundles=b1)
        cl3 = CClass(self.mcl,
                     "CL3",
                     superclasses=cl2,
                     attributes={"i": 1},
                     bundles=b1)
        cl3.set_value("i", 7)
        o = CObject(cl3, bundles=b1)

        b1.remove(cl1)
        try:
            b1.remove(CClass(CMetaclass("MCL", bundles=b2), "CL2", bundles=b2))
            exception_expected_()
        except CException as e:
            eq_("'CL2' is not an element of the bundle", e.value)
        try:
            b1.remove(cl1)
            exception_expected_()
        except CException as e:
            eq_("'CL1' is not an element of the bundle", e.value)

        eq_(set(b1.get_elements(type=CClass)), {cl2, cl3})
        b1.remove(cl3)
        eq_(set(b1.get_elements(type=CClass)), {cl2})

        eq_(cl3.superclasses, [cl2])
        eq_(cl2.subclasses, [cl3])
        eq_(cl3.attribute_names, ["i"])
        eq_(cl3.metaclass, self.mcl)
        eq_(cl3.objects, [o])
        eq_(cl3.name, "CL3")
        eq_(cl3.bundles, [])
        eq_(b1.get_elements(type=CObject), [o])
        eq_(cl3.get_value("i"), 7)
예제 #8
0
 def test_delete_enum_having_two_bundles(self):
     b1 = CBundle("B1")
     b2 = CBundle("B2")
     e1 = CEnum("e1", bundles=[b1, b2])
     e2 = CEnum("e2", bundles=[b2])
     e1.delete()
     eq_(set(b1.get_elements(type=CEnum)), set())
     eq_(set(b2.get_elements(type=CEnum)), {e2})
     eq_(set(e1.bundles), set())
     eq_(set(e2.bundles), {b2})
 def test_bundle_delete_bundle(self):
     b1 = CBundle("B1", bundles=self.b1)
     b2 = CBundle("B2", bundles=self.b1)
     b3 = CBundle("P3", bundles=self.b1)
     self.b1.delete()
     eq_(set(self.b1.elements), set())
     eq_(b1.get_elements(type=CBundle), [])
     eq_(b1.elements, [])
     eq_(b2.get_elements(type=CBundle), [])
     eq_(b3.get_elements(type=CBundle), [])
 def test_delete_class_having_two_bundles(self):
     b1 = CBundle("B1")
     b2 = CBundle("B2")
     c1 = CClass(self.mcl, "c1", bundles=[b1, b2])
     c2 = CClass(self.mcl, "c2", bundles=[b2])
     c1.delete()
     eq_(set(b1.get_elements(type=CClass)), set())
     eq_(set(b2.get_elements(type=CClass)), {c2})
     eq_(set(c1.bundles), set())
     eq_(set(c2.bundles), {b2})
예제 #11
0
 def test_delete_stereotype_having_two_bundles(self):
     b1 = CBundle("B1")
     b2 = CBundle("B2")
     s1 = CStereotype("s1", bundles=[b1, b2])
     s2 = CStereotype("s2", bundles=[b2])
     s1.delete()
     eq_(set(b1.get_elements(type=CStereotype)), set())
     eq_(set(b2.get_elements(type=CStereotype)), {s2})
     eq_(set(s1.bundles), set())
     eq_(set(s2.bundles), {b2})
 def test_delete_bundle_having_two_bundles(self):
     b1 = CBundle("B1")
     b2 = CBundle("B2")
     ba = CBundle("ba", bundles=[b1, b2])
     bb = CBundle("bb", bundles=[b2])
     ba.delete()
     eq_(set(b1.get_elements(type=CBundle)), set())
     eq_(set(b2.get_elements(type=CBundle)), {bb})
     eq_(set(ba.bundles), set())
     eq_(set(bb.bundles), {b2})
 def test_delete_metaclass_having_two_bundles(self):
     b1 = CBundle("B1")
     b2 = CBundle("B2")
     m1 = CMetaclass("m1", bundles=[b1, b2])
     m2 = CMetaclass("m2", bundles=[b2])
     m1.delete()
     eq_(set(b1.get_elements(type=CMetaclass)), set())
     eq_(set(b2.get_elements(type=CMetaclass)), {m2})
     eq_(set(m1.bundles), set())
     eq_(set(m2.bundles), {b2})
    def test_remove_metaclass_from_bundle(self):
        b1 = CBundle("B1")
        b2 = CBundle("B2")
        m1 = CMetaclass("M1", bundles=b1)
        try:
            # noinspection PyTypeChecker
            b1.remove(None)
            exception_expected_()
        except CException as e:
            eq_("'None' is not an element of the bundle", e.value)
        try:
            b1.remove(CEnum("A"))
            exception_expected_()
        except CException as e:
            eq_("'A' is not an element of the bundle", e.value)
        try:
            b2.remove(m1)
            exception_expected_()
        except CException as e:
            eq_("'M1' is not an element of the bundle", e.value)
        b1.remove(m1)
        eq_(set(b1.get_elements(type=CMetaclass)), set())

        m1 = CMetaclass("M1", bundles=b1)
        m2 = CMetaclass("M1", bundles=b1)
        m3 = CMetaclass("M1", superclasses=m2, attributes={"i": 1}, bundles=b1)
        c = CClass(m3, bundles=b1)

        b1.remove(m1)
        try:
            b1.remove(CMetaclass("M2", bundles=b2))
            exception_expected_()
        except CException as e:
            eq_("'M2' is not an element of the bundle", e.value)
        try:
            b1.remove(m1)
            exception_expected_()
        except CException as e:
            eq_("'M1' is not an element of the bundle", e.value)

        eq_(set(b1.get_elements(type=CMetaclass)), {m2, m3})
        b1.remove(m3)
        eq_(set(b1.get_elements(type=CMetaclass)), {m2})

        eq_(m3.superclasses, [m2])
        eq_(m2.subclasses, [m3])
        eq_(m3.attribute_names, ["i"])
        eq_(m3.classes, [c])
        eq_(m3.name, "M1")
        eq_(m3.bundles, [])
        eq_(b1.get_elements(type=CClass), [c])
    def test_remove_bundle_from_bundle(self):
        b1 = CBundle("B1")
        b2 = CBundle("B2")
        ba = CBundle("A", bundles=b1)
        try:
            # noinspection PyTypeChecker
            b1.remove(None)
            exception_expected_()
        except CException as e:
            eq_("'None' is not an element of the bundle", e.value)
        try:
            b1.remove(CEnum("A"))
            exception_expected_()
        except CException as e:
            eq_("'A' is not an element of the bundle", e.value)
        try:
            b2.remove(ba)
            exception_expected_()
        except CException as e:
            eq_("'A' is not an element of the bundle", e.value)
        b1.remove(ba)
        eq_(set(b1.get_elements(type=CBundle)), set())

        mcl1 = CMetaclass("MCL")
        cl1 = CClass(mcl1, "CL")

        ba = CBundle("PA", bundles=b1)
        bb = CBundle("PB", bundles=b1)
        bc = CBundle("PC", bundles=b1, elements=[mcl1, cl1])

        b1.remove(ba)
        try:
            b1.remove(CBundle("PB", bundles=b2))
            exception_expected_()
        except CException as e:
            eq_("'PB' is not an element of the bundle", e.value)
        try:
            b1.remove(ba)
            exception_expected_()
        except CException as e:
            eq_("'PA' is not an element of the bundle", e.value)

        eq_(set(b1.get_elements(type=CBundle)), {bb, bc})
        b1.remove(bc)
        eq_(set(b1.get_elements(type=CBundle)), {bb})

        eq_(bc.get_elements(type=CBundle), [])
        eq_(bc.get_elements(type=CBundle), [])
        eq_(bc.elements, [mcl1, cl1])
예제 #16
0
 def test_bundle_defined_stereotype(self):
     s1 = CStereotype("s1")
     s2 = CStereotype("s2")
     s3 = CStereotype("s3")
     eq_(set(self.b1.get_elements(type=CStereotype)), set())
     b1 = CBundle("B1", elements=[s1, s2, s3])
     eq_(set(b1.elements), {s1, s2, s3})
     cl = CClass(self.mcl, "C", bundles=b1)
     eq_(set(b1.elements), {s1, s2, s3, cl})
     eq_(set(b1.get_elements(type=CStereotype)), {s1, s2, s3})
     b2 = CBundle("B2")
     b2.elements = [s2, s3]
     eq_(set(b2.get_elements(type=CStereotype)), {s2, s3})
     eq_(set(s1.bundles), {b1})
     eq_(set(s2.bundles), {b1, b2})
     eq_(set(s3.bundles), {b1, b2})
예제 #17
0
 def test_bundle_defined_enums(self):
     e1 = CEnum("E1", values=["A", "B", "C"])
     e2 = CEnum("E2", values=["A", "B", "C"])
     e3 = CEnum("E3", values=["A", "B", "C"])
     eq_(set(self.b1.get_elements(type=CEnum)), set())
     b1 = CBundle("B1", elements=[e1, e2, e3])
     eq_(set(b1.elements), {e1, e2, e3})
     self.mcl.bundles = b1
     eq_(set(b1.elements), {e1, e2, e3, self.mcl})
     eq_(set(b1.get_elements(type=CEnum)), {e1, e2, e3})
     b2 = CBundle("B2")
     b2.elements = [e2, e3]
     eq_(set(b2.get_elements(type=CEnum)), {e2, e3})
     eq_(set(e1.bundles), {b1})
     eq_(set(e2.bundles), {b1, b2})
     eq_(set(e3.bundles), {b1, b2})
 def test_bundle_defined_classes(self):
     cl1 = CClass(self.mcl, "Class1")
     cl2 = CClass(self.mcl, "Class2")
     cl3 = CClass(self.mcl, "Class3")
     eq_(set(self.b1.get_elements(type=CClass)), set())
     b1 = CBundle("B1", elements=[cl1, cl2, cl3])
     eq_(set(b1.elements), {cl1, cl2, cl3})
     self.mcl.bundles = b1
     eq_(set(b1.elements), {cl1, cl2, cl3, self.mcl})
     eq_(set(b1.get_elements(type=CClass)), {cl1, cl2, cl3})
     b2 = CBundle("B2")
     b2.elements = [cl2, cl3]
     eq_(set(b2.get_elements(type=CClass)), {cl2, cl3})
     eq_(set(cl1.bundles), {b1})
     eq_(set(cl2.bundles), {b1, b2})
     eq_(set(cl3.bundles), {b1, b2})
 def test_bundle_defined_metaclasses(self):
     m1 = CMetaclass("M1")
     m2 = CMetaclass("M2")
     m3 = CMetaclass("M3")
     eq_(set(self.b1.get_elements(type=CMetaclass)), set())
     b1 = CBundle("B1", elements=[m1, m2, m3])
     eq_(set(b1.elements), {m1, m2, m3})
     cl = CClass(m1, "C", bundles=b1)
     eq_(set(b1.elements), {m1, m2, m3, cl})
     eq_(set(b1.get_elements(type=CMetaclass)), {m1, m2, m3})
     b2 = CBundle("B2")
     b2.elements = [m2, m3]
     eq_(set(b2.get_elements(type=CMetaclass)), {m2, m3})
     eq_(set(m1.bundles), {b1})
     eq_(set(m2.bundles), {b1, b2})
     eq_(set(m3.bundles), {b1, b2})
예제 #20
0
    def test_remove_enum_from_bundle(self):
        b1 = CBundle("B1")
        b2 = CBundle("B2")
        e1 = CEnum("E1", bundles=b1)
        try:
            # noinspection PyTypeChecker
            b1.remove(None)
            exception_expected_()
        except CException as e:
            eq_("'None' is not an element of the bundle", e.value)
        try:
            b1.remove(CEnum("A"))
            exception_expected_()
        except CException as e:
            eq_("'A' is not an element of the bundle", e.value)
        try:
            b2.remove(e1)
            exception_expected_()
        except CException as e:
            eq_("'E1' is not an element of the bundle", e.value)
        b1.remove(e1)
        eq_(set(b1.get_elements(type=CEnum)), set())

        e1 = CEnum("E1", bundles=b1)
        e2 = CEnum("E2", bundles=b1)
        e3 = CEnum("E3", values=["1", "2"], bundles=b1)

        b1.remove(e1)
        try:
            b1.remove(CEnum("E2", bundles=b2))
            exception_expected_()
        except CException as e:
            eq_("'E2' is not an element of the bundle", e.value)
        try:
            b1.remove(e1)
            exception_expected_()
        except CException as e:
            eq_("'E1' is not an element of the bundle", e.value)

        eq_(set(b1.get_elements(type=CEnum)), {e2, e3})
        b1.remove(e3)
        eq_(set(b1.get_elements(type=CEnum)), {e2})

        eq_(e3.name, "E3")
        eq_(e3.bundles, [])
        eq_(e3.values, ["1", "2"])
    def test_delete_top_level_bundle(self):
        b1 = CBundle("B1")
        ba = CBundle("A", bundles=b1)
        b1.delete()
        eq_(b1.get_elements(type=CBundle), [])
        eq_(ba.get_elements(type=CBundle), [])

        b1 = CBundle("B1")
        mcl1 = CMetaclass("MCL")
        cl1 = CClass(mcl1, "CL")

        ba = CBundle("BA", bundles=b1)
        bb = CBundle("BB", bundles=b1)
        bc = CBundle("BC", bundles=b1, elements=[mcl1, cl1])

        b1.delete()
        eq_(b1.get_elements(type=CBundle), [])
        eq_(b1.elements, [])
        eq_(ba.get_elements(type=CBundle), [])
        eq_(bb.get_elements(type=CBundle), [])
        eq_(bc.get_elements(type=CBundle), [])
        eq_(bc.elements, [mcl1, cl1])
        eq_(bc.get_elements(type=CBundle), [])
        eq_(mcl1.classes, [cl1])
        eq_(mcl1.bundles, [bc])
        eq_(cl1.metaclass, mcl1)
        eq_(cl1.bundles, [bc])
 def test_bundle_defined_by_bundle_list(self):
     b1 = CBundle("B1")
     b2 = CBundle("B2")
     b3 = CBundle("P3")
     eq_(set(self.b1.get_elements(type=CBundle)), set())
     ba = CBundle("PA", elements=[b1, b2, b3])
     eq_(set(ba.elements), {b1, b2, b3})
     self.mcl.bundles = ba
     eq_(set(ba.elements), {b1, b2, b3, self.mcl})
     eq_(set(ba.get_elements(type=CBundle)), {b1, b2, b3})
     bb = CBundle("PB")
     bb.elements = [b2, b3]
     eq_(set(bb.get_elements(type=CBundle)), {b2, b3})
     eq_(set(b1.bundles), {ba})
     eq_(set(b2.bundles), {ba, bb})
     eq_(set(b3.bundles), {ba, bb})
     eq_(set(ba.bundles), set())
     eq_(set(bb.bundles), set())
     eq_(set(b1.elements), set())
     eq_(set(b2.elements), set())
     eq_(set(b3.elements), set())
    def test_delete_bundle_from_bundle(self):
        b1 = CBundle("B1")
        ba = CBundle("A", bundles=b1)
        ba.delete()
        eq_(set(b1.get_elements(type=CBundle)), set())

        mcl1 = CMetaclass("MCL")
        cl1 = CClass(mcl1, "CL")

        ba = CBundle("PA", bundles=b1)
        bb = CBundle("PB", bundles=b1)
        bc = CBundle("PC", bundles=b1, elements=[mcl1, cl1])

        ba.delete()
        eq_(set(b1.get_elements(type=CBundle)), {bb, bc})
        bc.delete()
        eq_(set(b1.get_elements(type=CBundle)), {bb})

        eq_(bc.get_elements(type=CBundle), [])
        eq_(bc.get_elements(type=CBundle), [])
        eq_(bc.elements, [])
예제 #24
0
    def test_delete_stereotype_from_bundle(self):
        b1 = CBundle("B1")
        s1 = CStereotype("s1", bundles=b1)
        s1.delete()
        eq_(set(b1.get_elements(type=CStereotype)), set())

        s1 = CStereotype("s1", bundles=b1)
        s2 = CStereotype("s1", bundles=b1)
        s3 = CStereotype("s1",
                         superclasses=s2,
                         attributes={"i": 1},
                         bundles=b1,
                         extended=self.mcl)
        s4 = CStereotype("s1",
                         superclasses=s2,
                         attributes={"i": 1},
                         bundles=b1,
                         extended=self.a)

        s1.delete()
        eq_(set(b1.get_elements(type=CStereotype)), {s2, s3, s4})
        s3.delete()
        s4.delete()
        eq_(set(b1.get_elements(type=CStereotype)), {s2})

        eq_(s3.superclasses, [])
        eq_(s2.subclasses, [])
        eq_(s3.attributes, [])
        eq_(s3.attribute_names, [])
        eq_(s3.extended, [])
        eq_(s3.name, None)
        eq_(s3.bundles, [])

        eq_(s4.superclasses, [])
        eq_(s4.attributes, [])
        eq_(s4.attribute_names, [])
        eq_(s4.extended, [])
        eq_(s4.name, None)
        eq_(s4.bundles, [])
    def test_delete_metaclass_from_bundle(self):
        b1 = CBundle("B1")
        CBundle("B2")
        m1 = CMetaclass("M1", bundles=b1)
        m1.delete()
        eq_(set(b1.get_elements(type=CMetaclass)), set())

        m1 = CMetaclass("M1", bundles=b1)
        m2 = CMetaclass("M1", bundles=b1)
        m3 = CMetaclass("M1", superclasses=m2, attributes={"i": 1}, bundles=b1)
        CClass(m3, bundles=b1)
        m1.delete()
        eq_(set(b1.get_elements(type=CMetaclass)), {m2, m3})
        m3.delete()
        eq_(set(b1.get_elements(type=CMetaclass)), {m2})

        eq_(m3.superclasses, [])
        eq_(m2.subclasses, [])
        eq_(m3.attributes, [])
        eq_(m3.attribute_names, [])
        eq_(m3.classes, [])
        eq_(m3.name, None)
        eq_(m3.bundles, [])
        eq_(b1.get_elements(type=CClass), [])
 def test_class_defined_bundle_change(self):
     cl1 = CClass(self.mcl, "Class1", bundles=self.b1)
     cl2 = CClass(self.mcl, "Class2", bundles=self.b1)
     cl3 = CClass(self.mcl, "Class3", bundles=self.b1)
     mcl = CMetaclass("MCL", bundles=self.b1)
     b = CBundle()
     cl2.bundles = b
     cl3.bundles = None
     self.mcl.bundles = b
     eq_(set(self.b1.elements), {mcl, cl1})
     eq_(set(self.b1.get_elements(type=CClass)), {cl1})
     eq_(set(b.elements), {cl2, self.mcl})
     eq_(set(b.get_elements(type=CClass)), {cl2})
     eq_(cl1.bundles, [self.b1])
     eq_(cl2.bundles, [b])
     eq_(cl3.bundles, [])
 def test_bundle_defined_bundle_change(self):
     b1 = CBundle("B1", bundles=self.b1)
     b2 = CBundle("B2", bundles=self.b1)
     b3 = CBundle("P3", bundles=self.b1)
     mcl = CMetaclass("MCL", bundles=self.b1)
     b = CBundle()
     b2.bundles = b
     b3.bundles = None
     self.mcl.bundles = b
     eq_(set(self.b1.elements), {mcl, b1})
     eq_(set(self.b1.get_elements(type=CBundle)), {b1})
     eq_(set(b.elements), {b2, self.mcl})
     eq_(set(b.get_elements(type=CBundle)), {b2})
     eq_(b1.bundles, [self.b1])
     eq_(b2.bundles, [b])
     eq_(b3.bundles, [])
예제 #28
0
 def test_enum_defined_bundle_change(self):
     e1 = CEnum("E1", bundles=self.b1)
     e2 = CEnum("E2", bundles=self.b1)
     e3 = CEnum("E3", bundles=self.b1)
     mcl = CMetaclass("MCL", bundles=self.b1)
     b = CBundle()
     e2.bundles = b
     e3.bundles = None
     self.mcl.bundles = b
     eq_(set(self.b1.elements), {mcl, e1})
     eq_(set(self.b1.get_elements(type=CEnum)), {e1})
     eq_(set(b.elements), {e2, self.mcl})
     eq_(set(b.get_elements(type=CEnum)), {e2})
     eq_(e1.bundles, [self.b1])
     eq_(e2.bundles, [b])
     eq_(e3.bundles, [])
예제 #29
0
 def test_stereotype_defined_bundle_change(self):
     s1 = CStereotype("s1", bundles=self.b1)
     s2 = CStereotype("s2", bundles=self.b1)
     s3 = CStereotype("s3", bundles=self.b1)
     cl1 = CClass(self.mcl, "C1", bundles=self.b1)
     cl2 = CClass(self.mcl, "C2", bundles=self.b1)
     b = CBundle()
     s2.bundles = b
     s3.bundles = None
     cl2.bundles = b
     eq_(set(self.b1.elements), {cl1, s1})
     eq_(set(self.b1.get_elements(type=CStereotype)), {s1})
     eq_(set(b.elements), {s2, cl2})
     eq_(set(b.get_elements(type=CStereotype)), {s2})
     eq_(s1.bundles, [self.b1])
     eq_(s2.bundles, [b])
     eq_(s3.bundles, [])
 def test_metaclass_defined_bundle_change(self):
     m1 = CMetaclass("M1", bundles=self.b1)
     m2 = CMetaclass("M2", bundles=self.b1)
     m3 = CMetaclass("M3", bundles=self.b1)
     cl1 = CClass(m1, "C1", bundles=self.b1)
     cl2 = CClass(m1, "C2", bundles=self.b1)
     b = CBundle()
     m2.bundles = b
     m3.bundles = None
     cl2.bundles = b
     eq_(set(self.b1.elements), {cl1, m1})
     eq_(set(self.b1.get_elements(type=CMetaclass)), {m1})
     eq_(set(b.elements), {m2, cl2})
     eq_(set(b.get_elements(type=CMetaclass)), {m2})
     eq_(m1.bundles, [self.b1])
     eq_(m2.bundles, [b])
     eq_(m3.bundles, [])