예제 #1
0
 def test_valid_input(self):
     delta_strings = ['1 year', '2 months', '3 days', '3s', '2y', '10m']
     expected_results = [('year', 1), ('months', 2), ('days', 3), ('s', 3),
                         ('y', 2), ('m', 10)]
     for index, delta_string in enumerate(delta_strings):
         result = parse_delta_string(delta_string)
         assert result == expected_results[index]
예제 #2
0
파일: test_utils.py 프로젝트: zshi1/triage
 def test_valid_input(self):
     delta_strings = ["1 year", "2 months", "3 days", "3s", "2y", "10m"]
     expected_results = [
         ("year", 1),
         ("months", 2),
         ("days", 3),
         ("s", 3),
         ("y", 2),
         ("m", 10),
     ]
     for index, delta_string in enumerate(delta_strings):
         result = parse_delta_string(delta_string)
         assert result == expected_results[index]
예제 #3
0
 def test_invalid_input(self):
     delta_strings = ['one year', 'one_year', 'ay']
     for delta_string in delta_strings:
         with self.assertRaises(ValueError):
             parse_delta_string(delta_string)