def test_langs(self): langs = cuneiform.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)"))
def test_langs(self, popen): stdout = MagicMock() stdout.stdout.read.return_value = ( b"Cuneiform for Linux 1.1.0\n" b"Supported languages: eng ger fra rus swe spa ita ruseng ukr srp " b"hrv pol dan por dut cze rum hun bul slv lav lit est tur.") popen.return_value = stdout langs = cuneiform.get_available_languages() self.assertIn("eng", langs) self.assertIn("fra", langs) popen.assert_called_once_with(["cuneiform", "-l"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)