diff options
author | Seth Morton <seth.m.morton@gmail.com> | 2020-01-27 22:48:51 -0800 |
---|---|---|
committer | Seth Morton <seth.m.morton@gmail.com> | 2020-01-27 22:49:51 -0800 |
commit | 523816512213b4bfef98dfafd29885a504a5592c (patch) | |
tree | 3473d83ca1db38f944da1cd1c6a252a8a9634e93 | |
parent | 4928f4d8298bb85a57db24aecdacdd5edcd0fd31 (diff) | |
download | natsort-523816512213b4bfef98dfafd29885a504a5592c.tar.gz |
Add tests to challenge de locale
These tests make sure the locale number formatting regex works
correctly.
-rw-r--r-- | tests/test_input_string_transform_factory.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_input_string_transform_factory.py b/tests/test_input_string_transform_factory.py index 27dd725..7d54afd 100644 --- a/tests/test_input_string_transform_factory.py +++ b/tests/test_input_string_transform_factory.py @@ -75,6 +75,20 @@ def test_input_string_transform_factory_handles_us_locale(x, expected): @pytest.mark.parametrize( + "x, expected", + [ + ("12.543.642642,5345.34980", "12543.642642,5345.34980"), + ("12.59443.642.642,53.4534980", "12.59443.642642,53.4534980"), # No change + ("12543.642.642,5.34534980", "12543.642642,5.34534980"), + ], +) +@pytest.mark.usefixtures("with_locale_de_de") +def test_input_string_transform_factory_handles_de_locale(x, expected): + input_string_transform_func = input_string_transform_factory(ns.LOCALE) + assert input_string_transform_func(x) == expected + + +@pytest.mark.parametrize( "alg, expected", [ (ns.LOCALE, "1543,753"), # Does nothing without FLOAT |