def test_unicode_object_to_bytes(self): if not py3k.PY3: pytest.skip("Py2 object has `__str__` method called 1st") instance = self.__build_test_instance("__str__", UNICODE_STRING) returned = py3k.to_bytes(instance) self.assertStringsEqual(BYTES_STRING, returned)
def test_to_bytes(): returned = compat.to_bytes(O()) _assert_strings_equal(BYTES_STRING, returned)
def test_to_bytes(self): returned = compat.to_bytes(self.o) self.assertStringsEqual(BYTES_STRING, returned)
def test_repr_object_to_bytes(): value = UNICODE_STRING if py3k.PY3 else BYTES_STRING instance = _build_test_instance("__repr__", value) returned = py3k.to_bytes(instance) _assert_strings_equal(BYTES_STRING, returned)
def test_unicode_object_to_bytes(): instance = _build_test_instance("__str__", UNICODE_STRING) returned = py3k.to_bytes(instance) _assert_strings_equal(BYTES_STRING, returned)
def test_unicode_to_bytes(): returned = py3k.to_bytes(UNICODE_STRING) _assert_strings_equal(BYTES_STRING, returned)
def test_bytes_to_bytes(): returned = py3k.to_bytes(BYTES_STRING) _assert_strings_equal(BYTES_STRING, returned)
def test_repr_object_to_bytes(self): value = UNICODE_STRING if py3k.PY3 else BYTES_STRING instance = self.__build_test_instance("__repr__", value) returned = py3k.to_bytes(instance) self.assertStringsEqual(BYTES_STRING, returned)
def test_unicode_to_bytes(self): returned = py3k.to_bytes(UNICODE_STRING) self.assertStringsEqual(BYTES_STRING, returned)
def test_bytes_to_bytes(self): returned = py3k.to_bytes(BYTES_STRING) self.assertStringsEqual(BYTES_STRING, returned)