Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_nolangs(self):
tessdata_prefix = os.getenv("TESSDATA_PREFIX", "")
os.environ['TESSDATA_PREFIX'] = '/opt/tulipe'
try:
langs = libtesseract.get_available_languages()
self.assertEqual(langs, [])
finally:
if tessdata_prefix == "":
os.environ['TESSDATA_PREFIX'] = ""
os.unsetenv("TESSDATA_PREFIX")
else:
os.environ['TESSDATA_PREFIX'] = tessdata_prefix
def test_langs(self):
langs = libtesseract.get_available_languages()
self.assertTrue("eng" in langs,
("English training does not appear to be installed."
" (required for the tests)"))
self.assertTrue("fra" in langs,
("French training does not appear to be installed."
" (required for the tests)"))
self.assertTrue("jpn" in langs,
("Japanese training does not appear to be installed."
" (required for the tests)"))