From: Philipp Spitzer Date: Fri, 18 Mar 2022 15:23:15 +0000 (+0100) Subject: Rename files for consistency. X-Git-Url: https://git.toastfreeware.priv.at/philipp/winterrodeln/wrpylib.git/commitdiff_plain/ec34116564887d718c97ada1d844a35ebe3b8a0f Rename files for consistency. --- diff --git a/tests/test_lib_sledrun_json_to_wikitext.py b/tests/test_lib_sledrun_json_to_wikitext.py deleted file mode 100644 index 02c9cf9..0000000 --- a/tests/test_lib_sledrun_json_to_wikitext.py +++ /dev/null @@ -1,13 +0,0 @@ -import unittest - -from wrpylib.lib_sledrun_json_to_wikitext import strip_eol - - -class TestTrimEol(unittest.TestCase): - def test_trim_eol(self): - self.assertEqual('', strip_eol('')) - self.assertEqual(' abc\n', strip_eol(' abc ')) - self.assertEqual(' abc\n def\ngh\n', strip_eol(' abc\n def \ngh ')) - self.assertEqual('', strip_eol('\n\n')) - self.assertEqual('abc\n', strip_eol('abc \n')) - self.assertEqual('\na\n', strip_eol('\na\n\n')) diff --git a/tests/test_lib_sledrun_wikitext_from_json.py b/tests/test_lib_sledrun_wikitext_from_json.py new file mode 100644 index 0000000..f379cc4 --- /dev/null +++ b/tests/test_lib_sledrun_wikitext_from_json.py @@ -0,0 +1,13 @@ +import unittest + +from wrpylib.lib_sledrun_wikitext_from_json import strip_eol + + +class TestTrimEol(unittest.TestCase): + def test_trim_eol(self): + self.assertEqual('', strip_eol('')) + self.assertEqual(' abc\n', strip_eol(' abc ')) + self.assertEqual(' abc\n def\ngh\n', strip_eol(' abc\n def \ngh ')) + self.assertEqual('', strip_eol('\n\n')) + self.assertEqual('abc\n', strip_eol('abc \n')) + self.assertEqual('\na\n', strip_eol('\na\n\n')) diff --git a/wrpylib/lib_sledrun_json_to_wikitext.py b/wrpylib/lib_sledrun_json_to_wikitext.py deleted file mode 100644 index 86c5055..0000000 --- a/wrpylib/lib_sledrun_json_to_wikitext.py +++ /dev/null @@ -1,7 +0,0 @@ -def strip_eol(text: str) -> str: - """Remove each whitespace from end of lines of string and also remove trailing empty lines.""" - result = '\n'.join(line.rstrip() for line in text.splitlines(False)) - result = result.rstrip() - if len(result) > 0: - return result + '\n' - return '' diff --git a/wrpylib/lib_sledrun_wikitext_from_json.py b/wrpylib/lib_sledrun_wikitext_from_json.py new file mode 100644 index 0000000..86c5055 --- /dev/null +++ b/wrpylib/lib_sledrun_wikitext_from_json.py @@ -0,0 +1,7 @@ +def strip_eol(text: str) -> str: + """Remove each whitespace from end of lines of string and also remove trailing empty lines.""" + result = '\n'.join(line.rstrip() for line in text.splitlines(False)) + result = result.rstrip() + if len(result) > 0: + return result + '\n' + return '' diff --git a/wrpylib/wrmwmarkup.py b/wrpylib/wrmwmarkup.py index 66c9f59..91d876d 100644 --- a/wrpylib/wrmwmarkup.py +++ b/wrpylib/wrmwmarkup.py @@ -11,7 +11,7 @@ from mwparserfromhell.nodes import Template, Wikilink import wrpylib.wrvalidators import wrpylib.mwmarkup import wrpylib.wrmwdb -from wrpylib.lib_sledrun_json_to_wikitext import strip_eol +from wrpylib.lib_sledrun_wikitext_from_json import strip_eol from wrpylib.wrvalidators import LonLat, opt_lonlat_from_str, opt_lonlat_to_str, opt_uint_from_str, opt_uint_to_str, \ opt_str_opt_comment_enum_to_str, lift_german_to_str, webauskunft_to_str, cachet_german_to_str, \ opt_phone_comment_enum_to_str, lift_german_from_str, GASTHAUSBOX_DICT, opt_difficulty_german_from_str, \