Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] support/testing: add test for python-dicttoxml2
@ 2022-12-05  6:04 yegorslists--- via buildroot
  2022-12-11 20:19 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: yegorslists--- via buildroot @ 2022-12-05  6:04 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Petazzoni, Asaf Kahlon

From: Yegor Yefremov <yegorslists@googlemail.com>

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 DEVELOPERS                                           |  2 ++
 .../tests/package/sample_python_dicttoxml2.py        | 11 +++++++++++
 .../testing/tests/package/test_python_dicttoxml2.py  | 12 ++++++++++++
 3 files changed, 25 insertions(+)
 create mode 100644 support/testing/tests/package/sample_python_dicttoxml2.py
 create mode 100644 support/testing/tests/package/test_python_dicttoxml2.py

diff --git a/DEVELOPERS b/DEVELOPERS
index ab9cfe5ee9..3e3be6d094 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -3160,9 +3160,11 @@ F:	package/wpa_supplicant/
 F:	package/x11r7/xapp_xconsole/
 F:	package/x11r7/xapp_xinput-calibrator/
 F:	package/zlog/
+F:	support/testing/tests/package/sample_python_dicttoxml2.py
 F:	support/testing/tests/package/sample_python_dtschema.py
 F:	support/testing/tests/package/test_libftdi1.py
 F:	support/testing/tests/package/test_python_can.py
+F:	support/testing/tests/package/test_python_dicttoxml2.py
 F:	support/testing/tests/package/test_python_dtschema.py
 F:	utils/scanpypi
 
diff --git a/support/testing/tests/package/sample_python_dicttoxml2.py b/support/testing/tests/package/sample_python_dicttoxml2.py
new file mode 100644
index 0000000000..788c5e2cd7
--- /dev/null
+++ b/support/testing/tests/package/sample_python_dicttoxml2.py
@@ -0,0 +1,11 @@
+from dicttoxml2 import dicttoxml
+
+payload: dict = {'mylist': ['foo', 'bar', 'baz'], 'mydict': {'foo': 'bar', 'baz': 1}, 'ok': True}
+
+expected: bytes = b'<?xml version="1.0" encoding="UTF-8" ?><root><mylist type="list"><item type="str">' \
+                  b'<![CDATA[foo]]></item><item type="str"><![CDATA[bar]]></item><item type="str"><![CDATA[baz]]>' \
+                  b'</item></mylist><mydict type="dict"><foo type="str"><![CDATA[bar]]></foo><baz type="int">' \
+                  b'<![CDATA[1]]></baz></mydict><ok type="bool"><![CDATA[True]]>' \
+                  b'</ok></root>'
+
+assert dicttoxml(payload, cdata=True) == expected
diff --git a/support/testing/tests/package/test_python_dicttoxml2.py b/support/testing/tests/package/test_python_dicttoxml2.py
new file mode 100644
index 0000000000..437518db7f
--- /dev/null
+++ b/support/testing/tests/package/test_python_dicttoxml2.py
@@ -0,0 +1,12 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3Dicttoxml2(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_DICTTOXML2=y
+        """
+    sample_scripts = ["tests/package/sample_python_dicttoxml2.py"]
+    timeout = 40
-- 
2.17.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-11 20:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-05  6:04 [Buildroot] [PATCH] support/testing: add test for python-dicttoxml2 yegorslists--- via buildroot
2022-12-11 20:19 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox