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)
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' ]))
def test_with_alternative(self): self.assertEqual( 0, cli_detect([ '-a', './data/sample-arabic-1.txt', './data/sample-french.txt', './data/sample-chinese.txt' ]))
def test_multiple_file(self): self.assertEqual( 0, cli_detect([ './data/sample-arabic-1.txt', './data/sample-french.txt', './data/sample-chinese.txt' ]))
def test_multiple_file(self): self.assertEqual( 0, cli_detect([ './data/sample.1.ar.srt', './data/sample.1.he.srt', './data/sample-chinese.txt' ]))
def test_single_verbose_file(self): self.assertEqual( 0, cli_detect( ['./data/sample.1.ar.srt', '--verbose'] ) )
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
def test_force_replace_without_replace(self): self.assertEqual(cli_detect(['./data/sample-arabic-1.txt', '--force']), 1)
def test_single_verbose_file(self): self.assertEqual( 0, cli_detect(['./data/sample-arabic-1.txt', '--verbose']))