def test_line_parts(self): cl_object = processed_config_line(self.line, self.args) expect = { "command": ['tm', '=', 'thrax', 'pt', '12', 'example'], "comment": '# foo bar' } actual = cl_object.line_parts self.assertEqual(expect["command"], actual["command"])
def test_output_is_input(self): """ The resulting processed config line of a comment line is that same comment line. """ expect = '# This is the location of the file containing model weights.' actual = processed_config_line(expect, self.args).result() self.assertEqual(expect, actual)
def test_line_parts(self): cl_object = processed_config_line(self.line, self.args) expect = { "command": ['weights-file', '=', 'test/parser/weights'], "comment": '# foo bar' } actual = cl_object.line_parts self.assertEqual(expect["command"], actual["command"])
def test_output_is_input(self): """ The resulting processed config line of a comment line is that same comment line. """ expect = '# This is the location of the file containing model weights.' actual = processed_config_line(expect, self.args).result() self.assertEqual(expect, actual)
def test_output_is_input(self): """ The resulting processed config line of a comment line is that same comment line. """ cl_object = processed_config_line('', self.args) expect = '' actual = cl_object.result() self.assertEqual(expect, actual)
def test_output_is_input(self): """ The resulting processed config line of a comment line is that same comment line. """ cl_object = processed_config_line('', self.args) expect = '' actual = cl_object.result() self.assertEqual(expect, actual)
def setUp(self): self.line = 'weights-file = test/parser/weights # foo bar' args = Mock() self.args = args args.origdir = JOSHUA_PATH args.destdir = './testdestdir' self.destdir = args.destdir # Create the destination directory. if not os.path.exists(args.destdir): os.mkdir(args.destdir) self.cl_object = processed_config_line(self.line, args) self.expected_source_file_path = os.path.abspath(os.path.join(args.origdir, 'test', 'parser', 'weights')) self.expected_dest_file_path = os.path.abspath(os.path.join(args.destdir, 'weights')) CopyFileConfigLine.clear_file_name_counts()
def setUp(self): self.line = 'weights-file = test/parser/weights # foo bar' args = Mock() self.args = args args.origdir = JOSHUA_PATH args.destdir = './testdestdir' self.destdir = args.destdir # Create the destination directory. if not os.path.exists(args.destdir): os.mkdir(args.destdir) self.cl_object = processed_config_line(self.line, args) self.expected_source_file_path = os.path.abspath( os.path.join(args.origdir, 'test', 'parser', 'weights')) self.expected_dest_file_path = os.path.abspath( os.path.join(args.destdir, 'weights')) CopyFileConfigLine.clear_file_name_counts()
def test_line_copy_dirtree_result(self): cl_object = processed_config_line(self.line, self.args) expect = 'tm = thrax pt 12 example # foo bar' actual = cl_object.result() self.assertEqual(expect, actual)
def test_line_copy_dirtree(self): processed_config_line(self.line, self.args) expect = os.path.join(self.args.destdir, 'example', 'joshua.config') self.assertTrue(os.path.exists(expect))
def test_line_parts(self): cl_object = processed_config_line(self.line, self.args) expect = {"command": ['tm', '=', 'thrax', 'pt', '12', 'example'], "comment": '# foo bar'} actual = cl_object.line_parts self.assertEqual(expect["command"], actual["command"])
def test_line_parts(self): cl_object = processed_config_line(self.line, self.args) expect = {"command": ['weights-file', '=', 'test/parser/weights'], "comment": '# foo bar'} actual = cl_object.line_parts self.assertEqual(expect["command"], actual["command"])
def test_line_type(self): cl_object = processed_config_line(self.line, self.args) self.assertIsInstance(cl_object, ConfigLine)
def test_line_copy_dirtree_result(self): cl_object = processed_config_line(self.line, self.args) expect = 'tm = thrax pt 12 example # foo bar' actual = cl_object.result() self.assertEqual(expect, actual)
def test_line_copy_dirtree(self): processed_config_line(self.line, self.args) expect = os.path.join(self.args.destdir, 'example', 'joshua.config') self.assertTrue(os.path.exists(expect))
def test_line_type(self): cl_object = processed_config_line(self.line, self.args) self.assertIsInstance(cl_object, ConfigLine)