From f9ce0bc32db3bdd8a5947a18039c557c750f2957 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 9 Sep 2022 06:44:59 +0300 Subject: Refactor: Add tests and handle edge case Remove mutation of state, and handle the edge case where the sub-sequence could be an empty sequence. --- .../tests/unit/wqflask/show_trait/test_get_max_digits.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 wqflask/tests/unit/wqflask/show_trait/test_get_max_digits.py (limited to 'wqflask/tests') diff --git a/wqflask/tests/unit/wqflask/show_trait/test_get_max_digits.py b/wqflask/tests/unit/wqflask/show_trait/test_get_max_digits.py new file mode 100644 index 00000000..509f6c3a --- /dev/null +++ b/wqflask/tests/unit/wqflask/show_trait/test_get_max_digits.py @@ -0,0 +1,13 @@ +import pytest + +from wqflask.show_trait.show_trait import get_max_digits + +@pytest.mark.parametrize( + "trait_vals,expected", + ((( + (0, 1345, 92, 734), + (234253, 33, 153, 5352), + (3542, 24, 135)), + [3, 5, 3]),)) +def test_get_max_digits(trait_vals, expected): + assert get_max_digits(trait_vals) == expected -- cgit v1.2.3