def test_parse_file_missing_file(self):
     out_dir = tempfile.mkdtemp(dir=self.temp_dir, prefix='linter_test_')
     file_path = os.path.join(out_dir, self.php_file_name)  # non-existant file
     sub_path = self.php_file_name
     file_name = "PHP.usfm"
     expected_warnings = 1
     linter = UsfmLinter(source_dir=out_dir)
     linter.parse_file(file_path, sub_path, file_name)
     self.verify_results_counts(expected_warnings, linter)
Exemplo n.º 2
0
 def test_parse_file_missing_file(self):
     out_dir = tempfile.mkdtemp(dir=self.temp_dir, prefix='linter_test_')
     file_path = os.path.join(out_dir,
                              self.php_file_name)  # non-existant file
     sub_path = self.php_file_name
     file_name = "PHP.usfm"
     expected_warnings = 1
     linter = UsfmLinter(source_dir=out_dir)
     linter.parse_file(file_path, sub_path, file_name)
     self.verify_results_counts(expected_warnings, linter)
 def test_EnUlbValid(self):
     out_dir = self.unzip_resource('en_ulb.zip')
     expected_warnings = 0
     start = time.time()
     rc = RC(out_dir)
     linter = UsfmLinter(source_dir=out_dir, rc=rc)
     linter.run()
     elapsed_seconds = int(time.time() - start)
     App.logger.debug("Checking time was " + str(elapsed_seconds) + " seconds")
     self.verify_results_counts(expected_warnings, linter)
 def test_parse_usfm_text_empty(self):
     sub_path = self.php_file_name
     file_name = "51-PHP.usfm"
     book_full_name = "51-PHP"
     book_code = "PHP"
     book_text = ''
     expected_warnings = 1
     linter = UsfmLinter()
     linter.parse_usfm_text(sub_path, file_name, book_text, book_full_name, book_code)
     self.verify_results_counts(expected_warnings, linter)
Exemplo n.º 5
0
 def test_EnUlbValid(self):
     out_dir = self.unzip_resource('en_ulb.zip')
     expected_warnings = 0
     start = time.time()
     rc = RC(out_dir)
     linter = UsfmLinter(source_dir=out_dir, rc=rc)
     linter.run()
     elapsed_seconds = int(time.time() - start)
     App.logger.debug("Checking time was " + str(elapsed_seconds) +
                      " seconds")
     self.verify_results_counts(expected_warnings, linter)
Exemplo n.º 6
0
 def test_parse_usfm_text_empty(self):
     sub_path = self.php_file_name
     file_name = "51-PHP.usfm"
     book_full_name = "51-PHP"
     book_code = "PHP"
     book_text = ''
     expected_warnings = 1
     linter = UsfmLinter()
     linter.parse_usfm_text(sub_path, file_name, book_text, book_full_name,
                            book_code)
     self.verify_results_counts(expected_warnings, linter)
 def test_EnUlbValidSubset(self):
     check_files = ['19-PSA.usfm','22-SNG.usfm','24-JER.usfm','25-LAM.usfm','35-HAB.usfm']
     out_dir = self.unzip_resource_only('en_ulb.zip', check_files)
     expected_warnings = 0
     start = time.time()
     rc = RC(out_dir)
     linter = UsfmLinter(source_dir=out_dir, rc=rc)
     linter.run()
     elapsed_seconds = int(time.time() - start)
     App.logger.debug("Checking time was " + str(elapsed_seconds) + " seconds")
     self.verify_results_counts(expected_warnings, linter)
Exemplo n.º 8
0
 def test_EnUlbValidSubset(self):
     check_files = [
         '19-PSA.usfm', '22-SNG.usfm', '24-JER.usfm', '25-LAM.usfm',
         '35-HAB.usfm'
     ]
     out_dir = self.unzip_resource_only('en_ulb.zip', check_files)
     expected_warnings = 0
     start = time.time()
     rc = RC(out_dir)
     linter = UsfmLinter(source_dir=out_dir, rc=rc)
     linter.run()
     elapsed_seconds = int(time.time() - start)
     App.logger.debug("Checking time was " + str(elapsed_seconds) +
                      " seconds")
     self.verify_results_counts(expected_warnings, linter)
Exemplo n.º 9
0
 def run_linter(self, out_dir):
     linter = UsfmLinter(source_dir=out_dir)
     linter.run()
     return linter
 def run_linter(self, out_dir):
     linter = UsfmLinter(source_dir=out_dir)
     linter.run()
     return linter