(x)
| 64 | |
| 65 | |
| 66 | def _cast_string(x): |
| 67 | if x is None: |
| 68 | # Preserve None as-is |
| 69 | return x |
| 70 | |
| 71 | if not isinstance(x, six.string_types): |
| 72 | value_type = type(x).__name__ |
| 73 | msg = 'Value "%s" must either be a string or None. Got "%s".' % (x, value_type) |
| 74 | raise ValueError(msg) |
| 75 | |
| 76 | x = to_unicode(x) |
| 77 | x = _cast_none(x) |
| 78 | return x |
| 79 | |
| 80 | |
| 81 | def _cast_none(x): |
nothing calls this directly
no test coverage detected