def testFailTimeWindowTwoSlotMissingSquareBrackets(self): test_string = "{\'T1\' : ['22:00', '23:00', \'T1\' : '22:00', '25:00']}" expect_answer = 'Time window should have two times, separated by a comma.' answer = validate_component_table_cell_values._time_intervals( test_string) self.assertEqual(answer, expect_answer)
def testGoodTimeWindowOneSlot(self): test_string = "{\'T1\' : ['22:00', '23:00']}" expect_answer = '' answer = validate_component_table_cell_values._time_intervals( test_string) self.assertEqual(answer, expect_answer)
def testFailTimeWindowTwoSlotSecondTimeWindowOK(self): test_string = "{\'T1\' : ['22:00', '23:00'], \'T1\' : ['22:00', '25:00']}" expect_answer = 'The hour provided is not an integer between 0 and 24.' answer = validate_component_table_cell_values._time_intervals( test_string) self.assertEqual(answer, expect_answer)
def testFailTimeWindowTwoSlotSecondTimeWindowNotCommaSeparated(self): test_string = "{\'T1\' : ['22:00', '23:00'], \'T1\' : ['22:00'| '23:00']}" expect_answer = 'Time window should have two times, separated by a comma.' answer = validate_component_table_cell_values._time_intervals( test_string) self.assertEqual(answer, expect_answer)
def testFailTimeWindowTwoSlotForgotFirstColon(self): test_string = "{\'T1\' ['22:00', '23:00'], \'T1\' : ['22:00', '23:00']}" expect_answer = 'Time window names and values should be separated by a colon (:).' answer = validate_component_table_cell_values._time_intervals( test_string) self.assertEqual(answer, expect_answer)
def testFailTimeWindowTwoSlotCommaInWrongPosition(self): test_string = "{\'T1\' : ['22:00', '23:00'], \'T1\' : ['22:00', '23:00'],}" expect_answer = 'Incorrect trailing comma.' answer = validate_component_table_cell_values._time_intervals( test_string) self.assertEqual(answer, expect_answer)
def testFailTimeWindowTwoSlotMissingQuotesOnName(self): test_string = "{T1 : ['22:00', '23:00'], \'T1\' : ['22:00', '23:00']}" expect_answer = 'Time window name not quoted.' answer = validate_component_table_cell_values._time_intervals( test_string) self.assertEqual(answer, expect_answer)
def testFailTimeWindowTwoSlotMissingComma(self): test_string = "{\'T1\' : ['22:00', '23:00'] \'T1\' : ['22:00', '23:00']}" expect_answer = 'Time windows not comma separated.' answer = validate_component_table_cell_values._time_intervals( test_string) self.assertEqual(answer, expect_answer)