def test_returnsTheStringEnteredForFilenameInCommandLineArgumentsIfValid(self, mock_isfile): for opt_form in ['-f', '--file']: sys.argv[1] = opt_form sys.argv[2] = self.EXTANT_FILE mock_isfile.side_effect = self.MOCK_EXTANT_FILES mock_isfile.return_value = True self.assertEqual(self.EXTANT_FILE, get_input_file_name())
def load(self): io_start = time.clock() try: self.input_file_name = get_input_file_name() except InvalidInputException as e: print "Error: %s" % str(e) exit(1) input_dictionary = FileReader(self.input_file_name).get_input() io_stop = time.clock() print "%f seconds to do file input operations" % (io_stop - io_start) parse_start = time.clock() self.graph = parse_input(input_dictionary) parse_stop = time.clock() print "%f seconds to parse graph edges" % (parse_stop - parse_start)