def test_match__match_at_start__returns_match(): # Given search_dfregex = r'%B %Y:' text = r'January 1997: Do some stuff for each of these years.. 1 => 1970, 2 => 1971, 3 =>1972, 4 => 1973,5=> 1974' # When actual_out = DatetimeMatcher().match(search_dfregex, text) # Then assert actual_out is not None assert actual_out.group(0) == r'January 1997:'
def test_search__matches_not_at_start__returns_first(): # Given search_dfregex = r'\s*(\d+)\s*\=\>\s*%Y,?' text = r'January 1997: Do some stuff for each of these years.. 1 => 1970, 2 => 1971, 3 =>1972, 4 => 1973,5=> 1974' # When actual_out = DatetimeMatcher().search(search_dfregex, text) # Then assert actual_out is not None assert actual_out.group(0) == r' 1 => 1970,'