comparison tests/test.py @ 502:4f90e1eb7af8

Make quote() and unquote() module globals and also export from configmix
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 18 Dec 2021 01:26:41 +0100
parents a9a291927a4b
children dffa692751b1
comparison
equal deleted inserted replaced
501:1c83389fb8dd 502:4f90e1eb7af8
1205 "value", 1205 "value",
1206 self._cfg.getvar_s("events.qc-2021%x2e1-5G-summit.xref.%x23")) 1206 self._cfg.getvar_s("events.qc-2021%x2e1-5G-summit.xref.%x23"))
1207 1207
1208 def test_quoting_and_unquoting_are_inverse(self): 1208 def test_quoting_and_unquoting_are_inverse(self):
1209 for c in """%.:#|"'{}[]""": 1209 for c in """%.:#|"'{}[]""":
1210 qc = self._cfg.quote(c) 1210 qc = configmix.quote(c)
1211 self.assertTrue(qc.startswith("%x") and len(qc) == 4) 1211 self.assertTrue(qc.startswith("%x") and len(qc) == 4)
1212 self.assertEqual(c, self._cfg.unquote(qc)) 1212 self.assertEqual(c, configmix.unquote(qc))
1213 1213
1214 def test_quoting_and_unquoting_are_identical(self): 1214 def test_quoting_and_unquoting_are_identical(self):
1215 # other characters 1215 # other characters
1216 for c in """abc09/""": 1216 for c in """abc09/""":
1217 qc = self._cfg.quote(c) 1217 qc = configmix.quote(c)
1218 self.assertEqual(c, qc) 1218 self.assertEqual(c, qc)
1219 self.assertEqual(c, self._cfg.unquote(qc)) 1219 self.assertEqual(c, configmix.unquote(qc))
1220 1220
1221 def test_namespace_quoting(self): 1221 def test_namespace_quoting(self):
1222 v1 = self._cfg.getvar("PY:version") 1222 v1 = self._cfg.getvar("PY:version")
1223 v2 = self._cfg.getvar("P%x59:version") 1223 v2 = self._cfg.getvar("P%x59:version")
1224 v3 = self._cfg.getvar("%U00000050Y:version") 1224 v3 = self._cfg.getvar("%U00000050Y:version")