diff --git a/src/expycted/core/matchers/matcher_proxy.py b/src/expycted/core/matchers/matcher_proxy.py index 1654925..5cf03a0 100644 --- a/src/expycted/core/matchers/matcher_proxy.py +++ b/src/expycted/core/matchers/matcher_proxy.py @@ -16,4 +16,4 @@ def __call__(self, expected: Any = ...): expected=expected, ) - self._expectation.qualifiers.clear() \ No newline at end of file + self._expectation.qualifiers.clear() diff --git a/src/expycted/internals/value.py b/src/expycted/internals/value.py index 055df50..ec370be 100644 --- a/src/expycted/internals/value.py +++ b/src/expycted/internals/value.py @@ -262,33 +262,30 @@ def be_lesser(self) -> LessThanMatcher: return self.be_lesser_than - - @property def be_lesser_or_equal_to(self) -> LessThanMatcher: """Alias for ``be_lesser_than_or_equal_to``.""" return self.be_lesser_than_or_equal_to + @property def be_less_than_or_equal_to(self) -> LessThanMatcher: """Alias for ``be_lesser_than_or_equal_to``.""" return self.be_lesser_than_or_equal_to + @property def be_less_or_equal(self) -> LessThanMatcher: """Alias for ``be_lesser_than_or_equal_to``.""" return self.be_lesser_than_or_equal_to + @property def be_lesser_or_equal(self) -> LessThanMatcher: """Alias for ``be_lesser_than_or_equal_to``.""" return self.be_lesser_than_or_equal_to - - - - @assertion_old def be_greater_or_equal_to(self, actual: Any) -> None: """Check whether the value is greater than or equal to something diff --git a/test/expect_to_not_test_suite.py b/test/expect_to_not_test_suite.py index de51971..897b1b0 100644 --- a/test/expect_to_not_test_suite.py +++ b/test/expect_to_not_test_suite.py @@ -38,22 +38,6 @@ def test_to_not_inherit(expected, actual, context): expect(expected).to.inherit(actual) -@expected_actual_params(stubs.LESS_THAN, extract_ids=False) -def test_to_not_be_greater_than(expected, actual, context): - expect(expected).to_not.be_greater_than(actual) - - with context.raises: - expect(expected).to.be_greater_than(actual) - - -@expected_actual_params(stubs.GREATER_THAN, extract_ids=False) -def test_to_not_be_lesser_than(expected, actual, context): - expect(expected).to_not.be_lesser_than(actual) - - with context.raises: - expect(expected).to.be_lesser_than(actual) - - @expected_params(stubs.NOT_NUMERIC, extract_ids=False) def test_to_not_be_numeric(expected, context): expect(expected).to_not.be_numeric() diff --git a/test/expect_to_test_suite.py b/test/expect_to_test_suite.py index 5b63008..d5a4d87 100644 --- a/test/expect_to_test_suite.py +++ b/test/expect_to_test_suite.py @@ -92,26 +92,6 @@ def test_to_be_greater_than(expected, actual, context): expect(expected).to_not.be_greater(actual) -@expected_actual_params(stubs.LESS_THAN, extract_ids=False) -def test_to_be_lesser_than(expected, actual, context): - expect(expected).to.be_lesser_than(actual) - expect(expected).to.be_less_than(actual) - expect(expected).to.be_less(actual) - expect(expected).to.be_lesser(actual) - - with context.raises: - expect(expected).to_not.be_lesser_than(actual) - - with context.raises: - expect(expected).to_not.be_less_than(actual) - - with context.raises: - expect(expected).to_not.be_less(actual) - - with context.raises: - expect(expected).to_not.be_lesser(actual) - - @expected_actual_params(stubs.GREATER_THAN_OR_EQUAL, extract_ids=False) def test_to_be_greater_than_or_equal_to(expected, actual, context): expect(expected).to.be_greater_than_or_equal_to(actual) @@ -128,30 +108,6 @@ def test_to_be_greater_than_or_equal_to(expected, actual, context): expect(expected).to_not.be_greater_or_equal(actual) -@expected_actual_params(stubs.LESS_THAN_OR_EQUAL, extract_ids=False) -def test_to_be_lesser_or_equal_to(expected, actual, context): - expect(expected).to.be_lesser_or_equal_to(actual) - expect(expected).to.be_lesser_than_or_equal_to(actual) - expect(expected).to.be_less_than_or_equal_to(actual) - expect(expected).to.be_less_or_equal(actual) - expect(expected).to.be_lesser_or_equal(actual) - - with context.raises: - expect(expected).to_not.be_lesser_or_equal_to(actual) - - with context.raises: - expect(expected).to_not.be_lesser_than_or_equal_to(actual) - - with context.raises: - expect(expected).to_not.be_less_than_or_equal_to(actual) - - with context.raises: - expect(expected).to_not.be_less_or_equal(actual) - - with context.raises: - expect(expected).to_not.be_lesser_or_equal(actual) - - @expected_params(stubs.NUMERIC, extract_ids=False) def test_to_be_numeric(expected, context): expect(expected).to.be_numeric() diff --git a/test/helpers/stubs.py b/test/helpers/stubs.py index 36c6320..4257c07 100644 --- a/test/helpers/stubs.py +++ b/test/helpers/stubs.py @@ -172,12 +172,6 @@ class Day(Enum): ([1, 0], [1]), ) -LESS_THAN = ( - (2, 3), - (3, 3.2), - ([1], [2]), - ([1], [1, 0]), -) GREATER_THAN_OR_EQUAL = ( *GREATER_THAN, @@ -185,12 +179,6 @@ class Day(Enum): ([1], [1]), ) -LESS_THAN_OR_EQUAL = ( - *LESS_THAN, - (1, 1.0), - ([1], [1]), -) - NUMERIC = ( 1, "1", diff --git a/test/unit/matchers/test_less_than_matcher.py b/test/unit/matchers/test_less_than_matcher.py index f21da01..83e6f95 100644 --- a/test/unit/matchers/test_less_than_matcher.py +++ b/test/unit/matchers/test_less_than_matcher.py @@ -27,43 +27,54 @@ def test_via_expect(context): expectation.to.be_less_than(1) -# @parametrize_expectation( -# [ -# (stubs.SINGLETON_OBJECT(), stubs.SINGLETON_OBJECT()), -# (True, 1, "True int equivalent"), -# (False, 0, "False int equivalent"), -# (1, 1.0, "int float equivalent"), -# (True, True, "bool"), -# (1, 1, "int"), -# (1.1, 1.1, "float"), -# ("hello", "hello", "str"), -# ([True, 1.1], [True, 1.1], "list"), -# ({True, 1.1}, {1.1, True}, "set ignore order"), -# ({"a": [True, 1.1]}, {"a": [True, 1.1]}, "dict"), -# ], -# matcher=EqualMatcher, -# wrap=False, -# ) -# def test_matches(expectation): -# matcher = expectation.matcher() - -# assert matcher(expectation.expected) is True - - -# @parametrize_expectation( -# [ -# (stubs.NOT_SINGLETON_OBJECT(), stubs.NOT_SINGLETON_OBJECT()), -# (True, "True", "bool (True) str equivalent"), -# (False, "False", "bool (False) str equivalent"), -# (1, "1", "int str equivalent"), -# ([True, 1.1], (True, 1.1), "list tuple equivalent"), -# (False, None, "False None equivalent"), -# (b"hello", "hello", "byte-str str equivalent"), -# ], -# matcher=EqualMatcher, -# wrap=False, -# ) -# def test_not_matches(expectation): -# matcher = expectation.matcher() - -# assert matcher(expectation.expected) is False +@parametrize_expectation( + [ + ("hello", "hello world"), + (2, 3), + (3, 3.2), + ([1], [2]), + ([1], [1, 0]), + ], + matcher=LessThanMatcher, + wrap=False, +) +def test_matches(expectation): + matcher = expectation.matcher() + + assert matcher(expectation.expected) is True + + +@parametrize_expectation( + [ + ("hello", "hello world"), + ("hello", "hello"), + (2, 3), + (2, 2), + (3, 3.2), + ([1], [2]), + ([1], [1]), + ], + matcher=LessThanMatcher, + wrap=False, +) +def test_or_equal_matches(expectation): + matcher = expectation.matcher(or_equal=True) + + assert matcher(expectation.expected) is True + + +@parametrize_expectation( + [ + ("hello world", "hello"), + (3, 2), + (3.2, 3), + ([2], [1]), + ([1, 0], [1]), + ], + matcher=LessThanMatcher, + wrap=False, +) +def test_not_matches(expectation): + matcher = expectation.matcher() + + assert matcher(expectation.expected) is False