From 1e6ad5d702181bce6aeb3d0704c36f124417227d Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sun, 17 Nov 2019 10:09:37 +0100 Subject: Add more tests --- lulua/test_text.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 lulua/test_text.py (limited to 'lulua/test_text.py') diff --git a/lulua/test_text.py b/lulua/test_text.py new file mode 100644 index 0000000..65aa3a1 --- /dev/null +++ b/lulua/test_text.py @@ -0,0 +1,48 @@ +# Copyright (c) 2019 lulua contributors +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +from .text import charMap, mapChars + +def test_map_chars_mapped (): + """ Make sure all chars in the map are mapped correctly """ + + inText = '' + expectText = '' + for k, v in charMap.items (): + inText += k + expectText += v + + outText = mapChars (inText, charMap) + assert outText == expectText + +def test_map_chars_not_mapped (): + """ No chars not in the map should be mapped """ + + inText = '' + expectText = '' + for k, v in charMap.items (): + inText += v + expectText += v + inText += 'a' + expectText += 'a' + + outText = mapChars (inText, charMap) + assert outText == expectText + -- cgit v1.2.3