def test_main(self): main(self.args) actual = os.path.exists(os.path.join(self.destdir, 'weights')) self.assertTrue(actual) with open(os.path.join(self.destdir, 'joshua.config')) as fh: actual = fh.read().splitlines() expect = ['weights-file = weights # foo bar', 'output-format = %1'] self.assertEqual(expect, actual)
def test_main_with_copy_config_options(self): """ For --copy_config_options, Space-separated options surrounded by a pair of quotes should not be split. """ main(self.args + ["--copy-config-options", "-topn 1"]) with open(os.path.join(self.destdir, 'joshua.config')) as fh: actual = fh.read().splitlines() expect = ['weights-file = weights # foo bar', 'output-format = %1', "topn = 1"] self.assertEqual(expect, actual) self.assertEqual(3, len(actual))
def test_main_with_copy_config_options(self): """ For --copy_config_options, Space-separated options surrounded by a pair of quotes should not be split. """ main(self.args + ["--copy-config-options", "-topn 1"]) with open(os.path.join(self.destdir, 'joshua.config')) as fh: actual = fh.read().splitlines() expect = [ 'weights-file = weights # foo bar', 'output-format = %1', "topn = 1" ] self.assertEqual(expect, actual) self.assertEqual(3, len(actual))