()
| 47 | |
| 48 | |
| 49 | def test_to_unicode(): |
| 50 | assert strings.to_unicode(u'юникод') == u'юникод' |
| 51 | assert strings.to_unicode('str') == u'str' |
| 52 | assert strings.to_unicode(u'строка'.encode('utf-8')) == u'строка' |
| 53 | assert strings.to_unicode(u'строка'.encode('cp1251'), 'cp1251') == u'строка' |
| 54 | if six.PY2: # __str__ should return str not bytes in Python3 |
| 55 | assert strings.to_unicode(Convertible()) == Convertible.text |
| 56 | assert strings.to_unicode(ConvertibleToUnicodeOnly()) == Convertible.text |
| 57 | with pytest.raises(UnicodeDecodeError): |
| 58 | strings.to_unicode(ConvertibleToStrOnly()) |
| 59 | with pytest.raises(UnicodeDecodeError): |
| 60 | strings.to_unicode(NonConvertible()) |
| 61 | |
| 62 | |
| 63 | def test_to_unicode_errors_replace(): |
nothing calls this directly
no test coverage detected