loosen the encoding requirement for detect_encoding

This commit is contained in:
Sergey Obukhov
2017-04-25 11:18:02 -07:00
parent 85a4c1d855
commit 6f159e8959
2 changed files with 4 additions and 2 deletions

View File

@@ -29,7 +29,9 @@ def test_unicode():
def test_detect_encoding():
eq_ ('ascii', u.detect_encoding(b'qwe').lower())
eq_ ('iso-8859-2', u.detect_encoding(u'Versi\xf3n'.encode('iso-8859-2')).lower())
ok_ (u.detect_encoding(
u'Versi\xf3n'.encode('iso-8859-2')).lower() in [
'iso-8859-1', 'iso-8859-2'])
eq_ ('utf-8', u.detect_encoding(u'привет'.encode('utf8')).lower())
# fallback to utf-8
with patch.object(u.chardet, 'detect') as detect: