コード例 #1
0
    def test_non_existent_file(self):

        with self.assertRaises(SystemExit) as cm:
            cli_detect(
                ['./data/not_found_data.txt']
            )

        self.assertEqual(cm.exception.code, 2)
コード例 #2
0
 def test_with_minimal_and_alt(self):
     self.assertEqual(
         0,
         cli_detect([
             '-m', '-a', './data/sample-arabic-1.txt',
             './data/sample-french.txt', './data/sample-chinese.txt'
         ]))
コード例 #3
0
 def test_with_alternative(self):
     self.assertEqual(
         0,
         cli_detect([
             '-a', './data/sample-arabic-1.txt', './data/sample-french.txt',
             './data/sample-chinese.txt'
         ]))
コード例 #4
0
 def test_multiple_file(self):
     self.assertEqual(
         0,
         cli_detect([
             './data/sample-arabic-1.txt', './data/sample-french.txt',
             './data/sample-chinese.txt'
         ]))
コード例 #5
0
 def test_multiple_file(self):
     self.assertEqual(
         0,
         cli_detect([
             './data/sample.1.ar.srt', './data/sample.1.he.srt',
             './data/sample-chinese.txt'
         ]))
コード例 #6
0
 def test_single_verbose_file(self):
     self.assertEqual(
         0,
         cli_detect(
             ['./data/sample.1.ar.srt', '--verbose']
         )
     )
コード例 #7
0
    def test_single_file_normalize(self):
        self.assertEqual(
            0, cli_detect(['./data/sample-arabic-1.txt', '--normalize']))

        self.assertTrue(exists('./data/sample-arabic-1.cp1256.txt'))

        try:
            remove('./data/sample-arabic-1.cp1256.txt')
        except:
            pass
コード例 #8
0
 def test_force_replace_without_replace(self):
     self.assertEqual(cli_detect(['./data/sample-arabic-1.txt', '--force']),
                      1)
コード例 #9
0
 def test_single_verbose_file(self):
     self.assertEqual(
         0, cli_detect(['./data/sample-arabic-1.txt', '--verbose']))