Ensure that the provided text value is represented as unicode. :param value: Value to convert. :type value: ``str`` or ``unicode`` :rtype: ``unicode``
(value)
| 36 | |
| 37 | |
| 38 | def to_unicode(value): |
| 39 | """ |
| 40 | Ensure that the provided text value is represented as unicode. |
| 41 | |
| 42 | :param value: Value to convert. |
| 43 | :type value: ``str`` or ``unicode`` |
| 44 | |
| 45 | :rtype: ``unicode`` |
| 46 | """ |
| 47 | if not isinstance(value, six.string_types): |
| 48 | raise ValueError('Value "%s" must be a string.' % (value)) |
| 49 | |
| 50 | if not isinstance(value, six.text_type): |
| 51 | value = six.u(value) |
| 52 | |
| 53 | return value |
| 54 | |
| 55 | |
| 56 | def to_ascii(value): |
no outgoing calls
no test coverage detected