File: test_objects.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 (17 lines) | stat: -rw-r--r-- 428 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from types import SimpleNamespace
from unittest import TestCase

from xsdata.utils import objects


class ObjectsTests(TestCase):
    def test_update(self):
        obj = SimpleNamespace()
        obj.foo = SimpleNamespace()
        obj.foo.bar = 2
        obj.bar = 1

        kwargs = {"foo.bar": 1, "bar": 2}
        objects.update(obj, **kwargs)
        self.assertEqual(1, obj.foo.bar)
        self.assertEqual(2, obj.bar)