1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-28 02:27:28 +00:00
bazarr/libs/langdetect/tests/test_language.py
2018-09-16 20:33:04 -04:00

24 lines
686 B
Python

import unittest
from langdetect.language import Language
class LanguageTest(unittest.TestCase):
def test_language(self):
lang = Language(None, 0)
self.assertTrue(lang.lang is None)
self.assertEqual(lang.prob, 0.0, 0.0001)
self.assertEqual(str(lang), '')
lang2 = Language('en', 1.0)
self.assertEqual(lang2.lang, 'en')
self.assertEqual(lang2.prob, 1.0, 0.0001)
self.assertEqual(str(lang2), 'en:1.0')
def test_cmp(self):
lang1 = Language('a', 0.1)
lang2 = Language('b', 0.5)
self.assertTrue(lang1 < lang2)
self.assertFalse(lang1 == lang2)
self.assertFalse(lang1 > lang1)