File: test_alternative.py

package info (click to toggle)
python-xsdata 24.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,936 kB
  • sloc: python: 29,257; xml: 404; makefile: 27; sh: 6
file content (26 lines) | stat: -rw-r--r-- 722 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from unittest import TestCase

from xsdata.models.xsd import Alternative


class AlternativeTests(TestCase):
    def test_property_real_name(self):
        obj = Alternative()
        self.assertEqual("value", obj.real_name)

        obj.id = "foo"
        self.assertEqual("foo", obj.real_name)

        obj.test = "@type='text'"
        self.assertEqual("type_text", obj.real_name)

    def test_property_bases(self):
        obj = Alternative()
        self.assertEqual([], list(obj.bases))

        obj.type = "foo"
        self.assertEqual(["foo"], list(obj.bases))

    def test_get_restrictions(self):
        obj = Alternative()
        self.assertEqual({"path": [("alt", id(obj), 0, 1)]}, obj.get_restrictions())