Пример #1
0
    def test_end_restriction(self):
        restriction = Restriction()
        not_restriction = Element()
        element = etree.Element("uno")

        self.parser.end_restriction(not_restriction, element)
        self.parser.end_restriction(restriction, element)

        default_open_content = DefaultOpenContent()
        self.parser.default_open_content = default_open_content
        self.parser.end_restriction(restriction, element)

        self.assertIs(default_open_content, restriction.open_content)

        open_content = OpenContent()
        restriction.open_content = open_content
        self.parser.end_restriction(restriction, element)
        self.assertIs(open_content, restriction.open_content)
Пример #2
0
    def test_end_restriction(self):
        restriction = Restriction()
        not_restriction = Element()

        self.parser.end_restriction(not_restriction)
        self.parser.end_restriction(restriction)

        default_open_content = DefaultOpenContent()
        self.parser.default_open_content = default_open_content
        self.parser.end_restriction(restriction)

        self.assertIs(default_open_content, restriction.open_content)

        open_content = OpenContent()
        restriction.open_content = open_content
        self.parser.end_restriction(restriction)
        self.assertIs(open_content, restriction.open_content)

        obj = ComplexType()
        self.parser.end_open_content(obj)
        self.assertIsNone(obj.open_content)