77class TestApi :
88 def setup_method (self ):
99 detectlanguage .configuration .api_key = os .environ ['DETECTLANGUAGE_API_KEY' ]
10-
10+
1111 def test_detect_code (self ):
1212 result = detectlanguage .detect_code ("Hello world" )
1313 assert result == 'en'
@@ -17,7 +17,7 @@ def test_detect(self):
1717 assert result [0 ]['language' ] == 'en'
1818
1919 def test_detect_with_array (self ):
20- with pytest .raises ( ValueError ):
20+ with pytest .warns ( DeprecationWarning , match = "use detect_batch" ):
2121 detectlanguage .detect (["Hello world" , "Ėjo ežiukas" ])
2222
2323 def test_detect_unicode (self ):
@@ -37,9 +37,18 @@ def test_languages(self):
3737 result = detectlanguage .languages ()
3838 assert { 'code' : 'en' , 'name' : 'English' } in result
3939
40+ def test_simple_detect (self ):
41+ with pytest .warns (DeprecationWarning , match = "simple_detect.*deprecated" ):
42+ result = detectlanguage .simple_detect ("Hello world" )
43+ assert result == 'en'
44+
45+ def test_user_status (self ):
46+ with pytest .warns (DeprecationWarning , match = "user_status.*deprecated" ):
47+ result = detectlanguage .user_status ()
48+ assert result ['status' ] == 'ACTIVE'
49+
4050class TestApiErrors :
4151 def test_invalid_key (self ):
4252 detectlanguage .configuration .api_key = 'invalid'
4353 with pytest .raises (detectlanguage .DetectLanguageError ):
4454 detectlanguage .detect ("Hello world" )
45-
0 commit comments