File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -32,10 +32,7 @@ def __init__(
3232
3333 @staticmethod
3434 def _get_value (locale_prediction , key : str ):
35- if (
36- key not in locale_prediction .keys ()
37- or locale_prediction ["language" ] == "N/A"
38- ):
35+ if key not in locale_prediction or locale_prediction [key ] == "N/A" :
3936 return None
4037 return locale_prediction [key ]
4138
Original file line number Diff line number Diff line change @@ -23,3 +23,18 @@ def test_constructor_almost_empty_field():
2323 assert locale .language is None
2424 assert locale .country is None
2525 assert locale .currency is None
26+
27+
28+ def test_constructor_empty_language ():
29+ field_dict = {
30+ "value" : "en-EN" ,
31+ "country" : "uk" ,
32+ "currency" : "GBP" ,
33+ "language" : "N/A" ,
34+ "confidence" : 0.1 ,
35+ }
36+ locale = Locale (field_dict )
37+ assert locale .language is None
38+ assert locale .country == "uk"
39+ assert locale .currency == "GBP"
40+ assert str (locale ) == "en-EN; uk; GBP;"
You can’t perform that action at this time.
0 commit comments