def test_is_match_equality_check_when_comparison_none(self): result = utils.is_match(1, 1) assert result is True result = utils.is_match('a', 'a') assert result is True result = utils.is_match(1, '1') assert result is False
def test_is_match_less_than_value_check(self): result = utils.is_match(1, 2, constants.COMPARISON_LT) assert result is True result = utils.is_match(2, 2, constants.COMPARISON_LT) assert result is False result = utils.is_match(None, 5, constants.COMPARISON_LT) assert result is False
def test_is_match_equality_check_when_comparison_none(self): result = utils.is_match(1, 1) assert result is True result = utils.is_match('a', 'a') assert result is True result = utils.is_match(1, '1') assert result is False
def test_is_match_iregex(self): result = utils.is_match('Monty Python 1234', r'M\w+\sPython\s\d+', constants.COMPARISON_IREGEX) assert result is True result = utils.is_match('Monty Python 1234', r'm\w+\spython\s\d+', constants.COMPARISON_IREGEX) assert result is True result = utils.is_match('Monty Python 1234', r'm\w+Holy Grail\s\d+', constants.COMPARISON_IREGEX) assert result is False
def test_is_match_greater_than_equal_to_value_check(self): result = utils.is_match(5, 3, constants.COMPARISON_GTE) assert result is True result = utils.is_match(5, 5, constants.COMPARISON_GTE) assert result is True result = utils.is_match(3, 5, constants.COMPARISON_GTE) assert result is False
def test_is_match_less_than_equal_to_value_check(self): result = utils.is_match(1, 2, constants.COMPARISON_LTE) assert result is True result = utils.is_match(1, 1, constants.COMPARISON_LTE) assert result is True result = utils.is_match(2, 1, constants.COMPARISON_LTE) assert result is False
def test_is_match_less_than_equal_to_value_check(self): result = utils.is_match(1, 2, constants.COMPARISON_LTE) assert result is True result = utils.is_match(1, 1, constants.COMPARISON_LTE) assert result is True result = utils.is_match(2, 1, constants.COMPARISON_LTE) assert result is False
def test_is_match_less_than_value_check(self): result = utils.is_match(1, 2, constants.COMPARISON_LT) assert result is True result = utils.is_match(2, 2, constants.COMPARISON_LT) assert result is False result = utils.is_match(None, 5, constants.COMPARISON_LT) assert result is False
def test_is_match_greater_than_equal_to_value_check(self): result = utils.is_match(5, 3, constants.COMPARISON_GTE) assert result is True result = utils.is_match(5, 5, constants.COMPARISON_GTE) assert result is True result = utils.is_match(3, 5, constants.COMPARISON_GTE) assert result is False
def test_is_match_iregex(self): result = utils.is_match('Monty Python 1234', r'M\w+\sPython\s\d+', constants.COMPARISON_IREGEX) assert result is True result = utils.is_match('Monty Python 1234', r'm\w+\spython\s\d+', constants.COMPARISON_IREGEX) assert result is True result = utils.is_match('Monty Python 1234', r'm\w+Holy Grail\s\d+', constants.COMPARISON_IREGEX) assert result is False
def test_is_match_greater_than_value_check(self): result = utils.is_match(5, 3, constants.COMPARISON_GT) assert result is True result = utils.is_match(3, 5, constants.COMPARISON_GT) assert result is False result = utils.is_match(None, 5, constants.COMPARISON_GT) assert result is False result = utils.is_match(0, -2, constants.COMPARISON_GT) assert result is True
def test_is_match_isnull_check(self): result = utils.is_match(1, True, constants.COMPARISON_ISNULL) assert result is False result = utils.is_match(1, False, constants.COMPARISON_ISNULL) assert result is True result = utils.is_match(None, True, constants.COMPARISON_ISNULL) assert result is True result = utils.is_match(None, False, constants.COMPARISON_ISNULL) assert result is False result = utils.is_match(None, 1, constants.COMPARISON_ISNULL) assert result is True
def test_is_match_isnull_check(self): result = utils.is_match(1, True, constants.COMPARISON_ISNULL) assert result is False result = utils.is_match(1, False, constants.COMPARISON_ISNULL) assert result is True result = utils.is_match(None, True, constants.COMPARISON_ISNULL) assert result is True result = utils.is_match(None, False, constants.COMPARISON_ISNULL) assert result is False result = utils.is_match(None, 1, constants.COMPARISON_ISNULL) assert result is True
def test_is_match_range_date_and_datetime(self): result = utils.is_match(date(2017, 1, 1), (date(2017, 1, 1), date(2017, 1, 2)), constants.COMPARISON_RANGE) assert result is True result = utils.is_match( datetime(2017, 1, 1, 0, 0, 0), (datetime(2017, 1, 1, 0, 0, 0), datetime(2017, 1, 1, 0, 0, 1)), constants.COMPARISON_RANGE ) assert result is True result = utils.is_match(date(2017, 1, 1), (date(2017, 1, 2), date(2017, 1, 3)), constants.COMPARISON_RANGE) assert result is False result = utils.is_match( datetime(2015, 1, 1, 0, 0, 0), (datetime(2015, 1, 1, 0, 0, 1), datetime(2015, 1, 1, 0, 0, 2)), constants.COMPARISON_RANGE ) assert result is False
def test_is_match_range_date_and_datetime(self): result = utils.is_match(date(2017, 1, 1), (date(2017, 1, 1), date(2017, 1, 2)), constants.COMPARISON_RANGE) assert result is True result = utils.is_match( datetime(2017, 1, 1, 0, 0, 0), (datetime(2017, 1, 1, 0, 0, 0), datetime(2017, 1, 1, 0, 0, 1)), constants.COMPARISON_RANGE ) assert result is True result = utils.is_match(date(2017, 1, 1), (date(2017, 1, 2), date(2017, 1, 3)), constants.COMPARISON_RANGE) assert result is False result = utils.is_match( datetime(2015, 1, 1, 0, 0, 0), (datetime(2015, 1, 1, 0, 0, 1), datetime(2015, 1, 1, 0, 0, 2)), constants.COMPARISON_RANGE ) assert result is False
def test_is_match_processes_date_field(self): result = utils.is_match(date(2017, 1, 1), 2016, (constants.COMPARISON_YEAR, constants.COMPARISON_GT)) assert result is True
def test_is_match_processes_datetime_field(self): result = utils.is_match(datetime(2017, 1, 1, 2, 3, 4), 1, (constants.COMPARISON_HOUR, constants.COMPARISON_LT)) assert result is False
def test_is_match_processes_date_field(self): result = utils.is_match(date(2017, 1, 1), 2016, (constants.COMPARISON_YEAR, constants.COMPARISON_GT)) assert result is True
def test_is_match_in_value_check(self): result = utils.is_match(2, [1, 3], constants.COMPARISON_IN) assert result is False result = utils.is_match(1, [1, 3], constants.COMPARISON_IN) assert result is True
def test_is_match_range_string(self): result = utils.is_match('b', ('b', 'c'), constants.COMPARISON_RANGE) assert result is True result = utils.is_match('a', ('b', 'c'), constants.COMPARISON_RANGE) assert result is False
def test_is_match_iendswith_check(self): result = utils.is_match('abc', 'c', constants.COMPARISON_IENDSWITH) assert result is True result = utils.is_match('abc', 'C', constants.COMPARISON_IENDSWITH) assert result is True
def test_is_match_istartswith_check(self): result = utils.is_match('abc', 'a', constants.COMPARISON_ISTARTSWITH) assert result is True result = utils.is_match('abc', 'A', constants.COMPARISON_ISTARTSWITH) assert result is True
def test_is_match_iendswith_check(self): result = utils.is_match('abc', 'c', constants.COMPARISON_IENDSWITH) assert result is True result = utils.is_match('abc', 'C', constants.COMPARISON_IENDSWITH) assert result is True
def test_is_match_in_value_check(self): result = utils.is_match(2, [1, 3], constants.COMPARISON_IN) assert result is False result = utils.is_match(1, [1, 3], constants.COMPARISON_IN) assert result is True
def test_is_match_istartswith_check(self): result = utils.is_match('abc', 'a', constants.COMPARISON_ISTARTSWITH) assert result is True result = utils.is_match('abc', 'A', constants.COMPARISON_ISTARTSWITH) assert result is True
def test_is_match_case_insensitive_contains_check(self): result = utils.is_match('abc', 'A', constants.COMPARISON_ICONTAINS) assert result is True result = utils.is_match('abc', 'a', constants.COMPARISON_ICONTAINS) assert result is True
def test_is_match_case_sensitive_contains_check(self): result = utils.is_match('abc', 'A', constants.COMPARISON_CONTAINS) assert result is False result = utils.is_match('abc', 'a', constants.COMPARISON_CONTAINS) assert result is True
def test_is_match_range_numeric(self): result = utils.is_match(2, (2, 3), constants.COMPARISON_RANGE) assert result is True result = utils.is_match(1, (2, 3), constants.COMPARISON_RANGE) assert result is False
def test_is_match_range_numeric(self): result = utils.is_match(2, (2, 3), constants.COMPARISON_RANGE) assert result is True result = utils.is_match(1, (2, 3), constants.COMPARISON_RANGE) assert result is False
def test_is_match_range_string(self): result = utils.is_match('b', ('b', 'c'), constants.COMPARISON_RANGE) assert result is True result = utils.is_match('a', ('b', 'c'), constants.COMPARISON_RANGE) assert result is False
def test_is_match_processes_datetime_field(self): result = utils.is_match(datetime(2017, 1, 1, 2, 3, 4), 1, (constants.COMPARISON_HOUR, constants.COMPARISON_LT)) assert result is False
def test_is_match_case_sensitive_equality_check(self): result = utils.is_match('a', 'A', constants.COMPARISON_EXACT) assert result is False result = utils.is_match('a', 'a', constants.COMPARISON_EXACT) assert result is True
def test_is_match_case_insensitive_equality_check(self): result = utils.is_match('a', 'A', constants.COMPARISON_IEXACT) assert result is True result = utils.is_match('a', 'a', constants.COMPARISON_IEXACT) assert result is True