diff MoinMoin/_tests/test_wikiutil.py @ 2567:b403a24f7c8f

(xorAxAx, johill) make saner looking anchors, no more sha hash
author Johannes Berg <johannes AT sipsolutions DOT net>
date Wed, 25 Jul 2007 15:34:01 +0200
parents fb05ca2c0bdc
children 80eac6fc152a
line wrap: on
line diff
--- a/MoinMoin/_tests/test_wikiutil.py	Wed Jul 25 14:56:52 2007 +0200
+++ b/MoinMoin/_tests/test_wikiutil.py	Wed Jul 25 15:34:01 2007 +0200
@@ -717,4 +717,18 @@
         assert ief(self.request, has_complex, u'b=2.007', [2.007])
 
 
+class TestAnchorNames:
+    def test_anchor_name_encoding(self):
+        tests = [
+            # text                    expected output
+            (u'\xf6\xf6ll\xdf\xdf',   '.2BAPYA9g-ll.2BAN8A3w-'),
+            (u'level 2',              'level_2'),
+        ]
+        for text, expected in tests:
+            yield self._check, text, expected
+
+    def _check(self, text, expected):
+        encoded = wikiutil.anchor_name_from_text(text)
+        assert expected == encoded
+
 coverage_modules = ['MoinMoin.wikiutil']