コード例 #1
0
ファイル: test_commands.py プロジェクト: samH99/LexisNexis
 def test_extract_from_files_no_file(self):
     """
     If the file path doesn't exist, it should be skipped.
     """
     testfile = ('lib/l10n_utils/tests/test_files/templates/'
                 'file_does_not_exist.html', )
     with capture_stdio() as out:
         extracted = next(extract_from_files(testfile, method_map=METHODS),
                          None)
     self.assertIsNone(extracted)
     self.assertEqual(out[0], '! %s does not exist!' % testfile)
コード例 #2
0
ファイル: test_commands.py プロジェクト: callahad/bedrock
 def test_extract_from_files_no_file(self):
     """
     If the file path doesn't exist, it should be skipped.
     """
     testfile = ('lib/l10n_utils/tests/test_files/templates/'
                 'file_does_not_exist.html',)
     with capture_stdio() as out:
         extracted = next(extract_from_files(testfile, method_map=METHODS),
                          None)
     self.assertIsNone(extracted)
     self.assertEqual(out[0], '! %s does not exist!' % testfile)
コード例 #3
0
ファイル: test_commands.py プロジェクト: samH99/LexisNexis
 def test_extract_from_files_no_match(self):
     """
     If the file path doesn't match a domain method, it should be skipped.
     """
     testfile = ('apps/mozorg/templates/mozorg/home.html', )
     with capture_stdio() as out:
         extracted = next(extract_from_files(testfile, method_map=METHODS),
                          None)
     self.assertIsNone(extracted)
     self.assertEqual(out[0],
                      '! %s does not match any domain methods!' % testfile)
コード例 #4
0
ファイル: test_commands.py プロジェクト: callahad/bedrock
 def test_extract_from_files_no_match(self):
     """
     If the file path doesn't match a domain method, it should be skipped.
     """
     testfile = ('apps/mozorg/templates/mozorg/home.html',)
     with capture_stdio() as out:
         extracted = next(extract_from_files(testfile, method_map=METHODS),
                          None)
     self.assertIsNone(extracted)
     self.assertEqual(out[0],
                      '! %s does not match any domain methods!' % testfile)
コード例 #5
0
ファイル: test_commands.py プロジェクト: samH99/LexisNexis
 def test_extract_from_files(self):
     """
     Should be able to extract strings from a specific file.
     """
     testfile = ('lib/l10n_utils/tests/test_files/templates/'
                 'even_more_lang_files.html', )
     with capture_stdio() as out:
         extracted = next(extract_from_files(testfile, method_map=METHODS))
     self.assertTupleEqual(extracted,
                           (testfile[0], 9, 'Mark it 8 Dude.', []))
     # test default callback
     self.assertEqual(out[0], '  %s' % testfile)
コード例 #6
0
ファイル: test_commands.py プロジェクト: callahad/bedrock
 def test_extract_from_files(self):
     """
     Should be able to extract strings from a specific file.
     """
     testfile = ('lib/l10n_utils/tests/test_files/templates/'
                 'even_more_lang_files.html',)
     with capture_stdio() as out:
         extracted = next(extract_from_files(testfile, method_map=METHODS))
     self.assertTupleEqual(extracted,
                           (testfile[0], 9, 'Mark it 8 Dude.', []))
     # test default callback
     self.assertEqual(out[0], '  %s' % testfile)
コード例 #7
0
ファイル: test_commands.py プロジェクト: samH99/LexisNexis
 def test_extract_from_multiple_files(self):
     """
     Should be able to extract strings from specific files.
     """
     basedir = 'lib/l10n_utils/tests/test_files/templates/'
     testfiles = (
         basedir + 'even_more_lang_files.html',
         basedir + 'some_lang_files.html',
     )
     good_extracts = (
         (testfiles[0], 9, 'Mark it 8 Dude.', []),
         (testfiles[1], 9, 'Is this your homework Larry?', []),
     )
     with capture_stdio() as out:
         for i, extracted in enumerate(
                 extract_from_files(testfiles, method_map=METHODS)):
             self.assertTupleEqual(extracted, good_extracts[i])
     self.assertEqual(out[0], '  %s\n  %s' % testfiles)
コード例 #8
0
ファイル: test_commands.py プロジェクト: callahad/bedrock
 def test_extract_from_multiple_files(self):
     """
     Should be able to extract strings from specific files.
     """
     basedir = 'lib/l10n_utils/tests/test_files/templates/'
     testfiles = (
         basedir + 'even_more_lang_files.html',
         basedir + 'some_lang_files.html',
     )
     good_extracts = (
         (testfiles[0], 9, 'Mark it 8 Dude.', []),
         (testfiles[1], 9, 'Is this your homework Larry?', []),
     )
     with capture_stdio() as out:
         for i, extracted in enumerate(
                 extract_from_files(testfiles, method_map=METHODS)):
             self.assertTupleEqual(extracted, good_extracts[i])
     self.assertEqual(out[0], '  %s\n  %s' % testfiles)