[Python-Dev] PEP 460: allowing %d and %f and mojibake (original) (raw)

Ethan Furman ethan at stoneleaf.us
Mon Jan 13 06:33:38 CET 2014


On 01/12/2014 02:32 PM, Mark Lawrence wrote:

I've just tried asciistr using your test code (having corrected the typo, it's assertIsInstance, not assertIsinstance :) and it looks like a very good starting point. Have you, or anyone else for that matter, actually tried asciistr out?

Ah, thanks for that fix, and thanks for trying it out. Um, how exactly did you try it out? This is what I did:

bytestring_test.py

from asciicompat import asciistr as bytestring

...

ethan at media:~/source/bytestring$ python3.4 bytestring_test.py .F.FFF

FAIL: test_bytestring_will_accept_codepoints_in_latin1 (main.TestByteString)

Traceback (most recent call last): File "bytestring_test.py", line 30, in test_bytestring_will_accept_codepoints_in_latin1 self.assertEqual(bytestring(char), bytes([ch])) AssertionError: '\x00' != b'\x00'

====================================================================== FAIL: test_from_str_plus_str (main.TestByteString)

Traceback (most recent call last): File "bytestring_test.py", line 9, in test_from_str_plus_str self.assertEqual(result, b'hello world') AssertionError: 'hello world' != b'hello world'

====================================================================== FAIL: test_interpolation (main.TestByteString)

Traceback (most recent call last): File "bytestring_test.py", line 33, in test_interpolation self.assertEqual(bytestring('Content-Length: %d') % 71, b'Content-Length: 71') AssertionError: 'Content-Length: 71' != b'Content-Length: 71'

====================================================================== FAIL: test_str_plus_from_str (main.TestByteString)

Traceback (most recent call last): File "bytestring_test.py", line 14, in test_str_plus_from_str result = 'hello' + bytestring('world') AssertionError: TypeError not raised


Ran 6 tests in 0.002s

FAILED (failures=4)

Four out of six failed is not a good beginning. :(

-- Ethan



More information about the Python-Dev mailing list