Skip to content

Commit

Permalink
add test coverage for null events
Browse files Browse the repository at this point in the history
  • Loading branch information
DGaffney committed Nov 4, 2024
1 parent 60721fa commit 3b8a6ca
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/test/test_langid.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,19 @@ def test_langid_api_get_without_text(self):
self.assertEqual('application/json', response.content_type)
self.assertEqual(200, response.status_code)

def test_null_prediction_cld(self):
with patch('cld3.get_language', ) as mock_cld3_get_language:
mock_cld3_get_language.return_value = None
expected = {
'result': {
'language': None,
'confidence': None
},
'raw': None,
'model': 'CLD3',
}
self.assertEqual(Cld3LangidProvider.langid(text), {})

def test_langid_api_post(self):
response = self.client.post(
'/text/langid/',
Expand Down

0 comments on commit 3b8a6ca

Please sign in to comment.