Mercurial > hgrepos > Python > libs > ConfigMix
diff tests/test.py @ 552:39e5d07d8dbc
Provide a C implementation of configmix.config._split_filters.
This is needed as precondition for implementation interpolate_variables in
C also.
Currently the speedup is not measurable but it does not hurt also.
Also provide some unit-tests for _split_filters().
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 02 Jan 2022 20:40:09 +0100 |
| parents | 79db28e879f8 |
| children | 9d2bd411f5c5 |
line wrap: on
line diff
--- a/tests/test.py Sun Jan 02 16:05:35 2022 +0100 +++ b/tests/test.py Sun Jan 02 20:40:09 2022 +0100 @@ -1903,6 +1903,24 @@ def test_split_ns_quoting(self): self.assertEqual((u":", u"%x3a"), self.split_ns(u"%x3a:%x3a")) + def test_split_filters_empty(self): + self.assertEqual((u"", []), self.split_filters(u"")) + + def test_split_filters_varname_only(self): + self.assertEqual((u"varname ", []), self.split_filters(u"varname ")) + + def test_split_filters_single_stripping(self): + self.assertEqual((u" the-varname", []), + self.split_filters(u" the-varname | ")) + + def test_split_filters_one(self): + self.assertEqual((u"the-varname", [u"None"]), + self.split_filters(u"the-varname |None")) + + def test_split_filters_many(self): + self.assertEqual((u"the-varname", [u"Empty", u"None"]), + self.split_filters(u"the-varname |Empty|None")) + class T09Parser(_TParserMixin, unittest.TestCase): @@ -1911,6 +1929,7 @@ self.quote = configmix.config.py_quote self.pathstr2path = configmix.config.py_pathstr2path self.split_ns = configmix.config._py_split_ns + self.split_filters = configmix.config._py_split_filters def test_split_ns_wrong_type(self): self.assertRaises( @@ -1939,6 +1958,7 @@ self.quote = configmix.config.fast_quote self.pathstr2path = configmix.config.fast_pathstr2path self.split_ns = configmix.config._fast_split_ns + self.split_filters = configmix.config._fast_split_filters def test_split_ns_wrong_type(self): self.assertRaises(
