Esempio 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)
Esempio 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)
Esempio n. 4
0
 def test_to_bytes(self):
     returned = compat.to_bytes(self.o)
     self.assertStringsEqual(BYTES_STRING, returned)
Esempio 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)
Esempio 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)
Esempio n. 7
0
def test_unicode_to_bytes():
    returned = py3k.to_bytes(UNICODE_STRING)
    _assert_strings_equal(BYTES_STRING, returned)
Esempio n. 8
0
def test_bytes_to_bytes():
    returned = py3k.to_bytes(BYTES_STRING)
    _assert_strings_equal(BYTES_STRING, returned)
Esempio 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)
Esempio n. 10
0
 def test_unicode_to_bytes(self):
     returned = py3k.to_bytes(UNICODE_STRING)
     self.assertStringsEqual(BYTES_STRING, returned)
Esempio n. 11
0
 def test_bytes_to_bytes(self):
     returned = py3k.to_bytes(BYTES_STRING)
     self.assertStringsEqual(BYTES_STRING, returned)
Esempio 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)
Esempio 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)
Esempio n. 14
0
def test_unicode_to_bytes():
    returned = py3k.to_bytes(UNICODE_STRING)
    _assert_strings_equal(BYTES_STRING, returned)
Esempio n. 15
0
def test_bytes_to_bytes():
    returned = py3k.to_bytes(BYTES_STRING)
    _assert_strings_equal(BYTES_STRING, returned)