Ejemplo n.º 1
0
    def test_property_real_type(self):
        obj = SimpleType()
        self.assertIsNone(obj.real_type)

        obj.union = Union(member_types="thug")
        self.assertEqual("thug", obj.real_type)

        obj.list = List(item_type="foo")
        self.assertEqual("foo", obj.real_type)

        obj.restriction = Restriction(base="bar")
        self.assertEqual("bar", obj.real_type)

        obj = SimpleType(restriction=Restriction())
        obj.restriction.enumerations.append(Enumeration())
        self.assertIsNone(obj.real_type)
Ejemplo n.º 2
0
    def test_property_attr_types(self):
        obj = SimpleType()
        self.assertEqual([], list(obj.attr_types))

        obj.union = Union(member_types="thug")
        self.assertEqual(["thug"], list(obj.attr_types))

        obj.list = List(item_type="foo")
        self.assertEqual(["foo"], list(obj.attr_types))

        obj.restriction = Restriction(base="bar")
        self.assertEqual(["bar"], list(obj.attr_types))

        obj = SimpleType(restriction=Restriction())
        obj.restriction.enumerations.append(Enumeration())
        self.assertEqual([], list(obj.attr_types))