diff options
author | Seth Morton <seth.m.morton@gmail.com> | 2023-02-27 08:38:56 -0800 |
---|---|---|
committer | Seth Morton <seth.m.morton@gmail.com> | 2023-02-27 08:41:39 -0800 |
commit | 0e7533d2799c4bc8cc6968cd6485b6996eee0a05 (patch) | |
tree | 277ca9d989b772665238fb14564bc76aae48c9ac /tests | |
parent | 4352d7b7b029a2636f8b5a68ebdb9ad86fbd860a (diff) | |
download | natsort-0e7533d2799c4bc8cc6968cd6485b6996eee0a05.tar.gz |
Fixed bug in NANLAST/NANFIRST
The previous code change to make NaN and None ordering consistent made
it so that NANLAST did not put NaN last. Oops.
It also had made it so that NaN wasn't first for NANFIRST. Oops.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_natsorted.py | 4 | ||||
-rw-r--r-- | tests/test_parse_number_function.py | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/tests/test_natsorted.py b/tests/test_natsorted.py index e4a4788..bd1cc39 100644 --- a/tests/test_natsorted.py +++ b/tests/test_natsorted.py @@ -113,8 +113,8 @@ def test_natsorted_handles_mixed_types( @pytest.mark.parametrize( "alg, expected", [ - (ns.DEFAULT, [None, float("nan"), float("-inf"), 5, "25", 1e40, float("inf")]), - (ns.NANLAST, [float("-inf"), 5, "25", 1e40, None, float("nan"), float("inf")]), + (ns.DEFAULT, [float("nan"), None, float("-inf"), 5, "25", 1e40, float("inf")]), + (ns.NANLAST, [float("-inf"), 5, "25", 1e40, float("inf"), None, float("nan")]), ], ) def test_natsorted_consistent_ordering_with_nan_and_friends( diff --git a/tests/test_parse_number_function.py b/tests/test_parse_number_function.py index 5ac5700..24ee714 100644 --- a/tests/test_parse_number_function.py +++ b/tests/test_parse_number_function.py @@ -35,17 +35,17 @@ def test_parse_number_factory_makes_function_that_returns_tuple( ( ns.DEFAULT, float("nan"), - ("", float("-inf"), "2"), + ("", float("-inf"), "1"), ), # NaN transformed to -infinity ( ns.NANLAST, float("nan"), - ("", float("+inf"), "2"), + ("", float("+inf"), "3"), ), # NANLAST makes it +infinity - (ns.DEFAULT, None, ("", float("-inf"), "1")), # None transformed to -infinity - (ns.NANLAST, None, ("", float("+inf"), "1")), # NANLAST makes it +infinity + (ns.DEFAULT, None, ("", float("-inf"), "2")), # None transformed to -infinity + (ns.NANLAST, None, ("", float("+inf"), "2")), # NANLAST makes it +infinity (ns.DEFAULT, float("-inf"), ("", float("-inf"), "3")), - (ns.NANLAST, float("+inf"), ("", float("+inf"), "3")), + (ns.NANLAST, float("+inf"), ("", float("+inf"), "1")), ], ) def test_parse_number_factory_treats_nan_and_none_special( |