Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
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)
Exemplo n.º 4
0
 def test_to_bytes(self):
     returned = compat.to_bytes(self.o)
     self.assertStringsEqual(BYTES_STRING, returned)
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
def test_unicode_object_to_bytes():
    instance = _build_test_instance("__str__", UNICODE_STRING)

    returned = py3k.to_bytes(instance)
    _assert_strings_equal(BYTES_STRING, returned)
Exemplo n.º 7
0
def test_unicode_to_bytes():
    returned = py3k.to_bytes(UNICODE_STRING)
    _assert_strings_equal(BYTES_STRING, returned)
Exemplo n.º 8
0
def test_bytes_to_bytes():
    returned = py3k.to_bytes(BYTES_STRING)
    _assert_strings_equal(BYTES_STRING, returned)
Exemplo n.º 9
0
    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)
Exemplo n.º 10
0
 def test_unicode_to_bytes(self):
     returned = py3k.to_bytes(UNICODE_STRING)
     self.assertStringsEqual(BYTES_STRING, returned)
Exemplo n.º 11
0
 def test_bytes_to_bytes(self):
     returned = py3k.to_bytes(BYTES_STRING)
     self.assertStringsEqual(BYTES_STRING, returned)
Exemplo n.º 12
0
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)
Exemplo n.º 13
0
def test_unicode_object_to_bytes():
    instance = _build_test_instance("__str__", UNICODE_STRING)

    returned = py3k.to_bytes(instance)
    _assert_strings_equal(BYTES_STRING, returned)
Exemplo n.º 14
0
def test_unicode_to_bytes():
    returned = py3k.to_bytes(UNICODE_STRING)
    _assert_strings_equal(BYTES_STRING, returned)
Exemplo n.º 15
0
def test_bytes_to_bytes():
    returned = py3k.to_bytes(BYTES_STRING)
    _assert_strings_equal(BYTES_STRING, returned)