def test_clear_file_name_counts(self):
     line = 'tm = blah blah blah grammar.packed'
     cl = config_line_factory(line, self.args)
     cl = config_line_factory(line, self.args)
     CopyFileConfigLine.clear_file_name_counts()
     cl = config_line_factory(line, self.args)
     self.assertEqual('tm = blah blah blah grammar.packed', cl.result())
Пример #2
0
 def test_clear_file_name_counts(self):
     line = 'tm = blah blah blah grammar.packed'
     cl = config_line_factory(line, self.args)
     cl = config_line_factory(line, self.args)
     CopyFileConfigLine.clear_file_name_counts()
     cl = config_line_factory(line, self.args)
     self.assertEqual('tm = blah blah blah grammar.packed', cl.result())
 def setUp(self):
     # N.B. specify a path to copytree that is not inside you application.
     # Otherwise it ends with an infinite recursion.
     self.line = 'tm = thrax pt 12 example # foo bar'
     self.args = Mock()
     self.args.origdir = os.path.join(JOSHUA_PATH, 'examples')
     self.args.destdir = './testdestdir'
     # Create the destination directory.
     if os.path.exists(self.args.destdir):
         clear_non_empty_dir(self.args.destdir)
     os.mkdir(self.args.destdir)
     CopyFileConfigLine.clear_file_name_counts()
Пример #4
0
 def setUp(self):
     # N.B. specify a path to copytree that is not inside you application.
     # Otherwise it ends with an infinite recursion.
     self.line = 'tm = thrax pt 12 example # foo bar'
     self.args = Mock()
     self.args.origdir = os.path.join(JOSHUA_PATH, 'examples')
     self.args.destdir = './testdestdir'
     # Create the destination directory.
     if os.path.exists(self.args.destdir):
         clear_non_empty_dir(self.args.destdir)
     os.mkdir(self.args.destdir)
     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()
Пример #6
0
 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):
     CopyFileConfigLine.clear_file_name_counts()
     self.line = 'weights-file = weights # foo bar\noutput-format = %1'
     self.origdir = '/tmp/testorigdir'
     self.destdir = '/tmp/testdestdir'
     for d in [self.origdir, self.destdir]:
         if os.path.exists(d):
             clear_non_empty_dir(d)
     # Create the destination directory.
     os.mkdir(self.origdir)
     os.mkdir(self.destdir)
     # Write the files to be processed.
     config_file = os.path.join(self.origdir, 'joshua.config')
     with open(config_file, 'w') as fh:
         fh.write(self.line)
     with open(os.path.join(self.origdir, 'weights'), 'w') as fh:
         fh.write("grammar data\n")
     self.args = ['thisprogram', '-f', config_file, self.origdir,
                  self.destdir]
Пример #8
0
 def setUp(self):
     CopyFileConfigLine.clear_file_name_counts()
     self.line = 'weights-file = weights # foo bar\noutput-format = %1'
     self.origdir = '/tmp/testorigdir'
     self.destdir = '/tmp/testdestdir'
     for d in [self.origdir, self.destdir]:
         if os.path.exists(d):
             clear_non_empty_dir(d)
     # Create the destination directory.
     os.mkdir(self.origdir)
     os.mkdir(self.destdir)
     # Write the files to be processed.
     config_file = os.path.join(self.origdir, 'joshua.config')
     with open(config_file, 'w') as fh:
         fh.write(self.line)
     with open(os.path.join(self.origdir, 'weights'), 'w') as fh:
         fh.write("grammar data\n")
     self.args = [
         'thisprogram', '-f', config_file, self.origdir, self.destdir
     ]
 def setUp(self):
     self.args = Mock()
     self.args.origdir = '/dev/null'
     self.args.destdir = '/dev/null'
     CopyFileConfigLine.clear_file_name_counts()
Пример #10
0
 def setUp(self):
     self.args = Mock()
     self.args.origdir = '/dev/null'
     self.args.destdir = '/dev/null'
     CopyFileConfigLine.clear_file_name_counts()