@@ -103,28 +103,26 @@ Usage
103103
104104The modules provide an ``encode `` and a ``decode `` function.
105105
106- In Python 2.x, the input should be a byte string. Basic usage (example in
107- Python 2.x)::
106+ The input should be a byte string, not a Unicode string. Basic usage::
108107
109108 >>> from cobs import cobs
110- >>> encoded = cobs.encode('Hello world\x00This is a test')
109+ >>> encoded = cobs.encode(b 'Hello world\x00This is a test')
111110 >>> encoded
112- '\x0cHello world\x0fThis is a test'
111+ b '\x0cHello world\x0fThis is a test'
113112 >>> cobs.decode(encoded)
114- 'Hello world\x00This is a test'
113+ b 'Hello world\x00This is a test'
115114
116115`COBS/R `_ usage is almost identical::
117116
118117 >>> from cobs import cobsr
119- >>> encoded = cobsr.encode('Hello world\x00This is a test')
118+ >>> encoded = cobsr.encode(b 'Hello world\x00This is a test')
120119 >>> encoded
121- '\x0cHello worldtThis is a tes'
120+ b '\x0cHello worldtThis is a tes'
122121 >>> cobsr.decode(encoded)
123- 'Hello world\x00This is a test'
122+ b 'Hello world\x00This is a test'
124123
125- For Python 3.x, input cannot be Unicode strings. Byte strings are acceptable
126- input. Any type that implements the buffer protocol, providing a single
127- block of bytes, is also acceptable as input::
124+ Any type that implements the buffer protocol, providing a single block of
125+ bytes, is also acceptable as input::
128126
129127 >>> from cobs import cobs
130128 >>> encoded = cobs.encode(bytearray(b'Hello world\x00This is a test'))
@@ -138,11 +136,10 @@ block of bytes, is also acceptable as input::
138136Supported Python Versions
139137-------------------------
140138
141- Python >= 2.4 and 3.x are supported, and have both a C extension and a pure
142- Python implementation.
139+ Python >= 3.6 are supported, and have both a C extension and a pure Python
140+ implementation.
143141
144- Python versions < 2.4 might work, but have not been tested. Python 3.0 has
145- also not been tested.
142+ Python versions < 3.6 might work, but have not been tested.
146143
147144
148145------------
@@ -164,16 +161,11 @@ implementation, using the following command::
164161Unit Testing
165162------------
166163
167- Basic unit testing is in the ``test `` sub-module, e.g. ``cobs.cobs.test ``. To run it on Python >=2.5 ::
164+ Basic unit testing is in the ``test `` sub-module, e.g. ``cobs.cobs.test ``. To run it::
168165
169166 python -m cobs.cobs.test
170167 python -m cobs.cobsr.test
171168
172- Alternatively, in the ``test `` directory run::
173-
174- python test_cobs.py
175- python test_cobsr.py
176-
177169
178170-------------
179171Documentation
0 commit comments