changeset 356:a5c792074ec9

Unittest to check "None" and "Empty" filters for existing values: they just pass through unchanged
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 24 Jun 2021 20:52:21 +0200
parents 260354e9a7f9
children dd454e1efea4
files tests/test.py
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test.py	Thu Jun 24 20:26:33 2021 +0200
+++ b/tests/test.py	Thu Jun 24 20:52:21 2021 +0200
@@ -422,6 +422,24 @@
         x = cfg.expand_variable("{{non-existing|Empty}}")
         self.assertEqual("", x)
 
+    def test11_None_filter_pass_through(self):
+        cfg = self._load(os.path.join(TESTDATADIR, "conf20.yml"),
+                         os.path.join(TESTDATADIR, "conf21.yml"),
+                         os.path.join(TESTDATADIR, "conf22.ini"),
+                         os.path.join(TESTDATADIR, "conf23.json"),
+                         os.path.join(TESTDATADIR, "conf24.toml"))
+        x = cfg.expand_variable("{{intl.cache.items|None}}")
+        self.assertEqual(10, x)
+
+    def test12_Empty_filter_pass_through(self):
+        cfg = self._load(os.path.join(TESTDATADIR, "conf20.yml"),
+                         os.path.join(TESTDATADIR, "conf21.yml"),
+                         os.path.join(TESTDATADIR, "conf22.ini"),
+                         os.path.join(TESTDATADIR, "conf23.json"),
+                         os.path.join(TESTDATADIR, "conf24.toml"))
+        x = cfg.expand_variable("{{intl.cache.items|Empty}}")
+        self.assertEqual(10, x)
+
 
 class T02LoadAndMerge(_T02MixinLoadAndMerge, unittest.TestCase):