cobs 1.2.2__tar.gz → 1.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cobs-1.2.2/cobs.egg-info → cobs-1.2.3}/PKG-INFO +1 -1
- {cobs-1.2.2 → cobs-1.2.3/cobs.egg-info}/PKG-INFO +1 -1
- {cobs-1.2.2 → cobs-1.2.3}/pyproject.toml +1 -1
- {cobs-1.2.2 → cobs-1.2.3}/setup.py +1 -1
- {cobs-1.2.2 → cobs-1.2.3}/src/cobs/_version/__init__.py +1 -1
- {cobs-1.2.2 → cobs-1.2.3}/src/cobs/cobs/test.py +8 -0
- {cobs-1.2.2 → cobs-1.2.3}/src/cobs/cobsr/test.py +8 -0
- {cobs-1.2.2 → cobs-1.2.3}/src/ext/_cobs_ext.c +1 -1
- {cobs-1.2.2 → cobs-1.2.3}/src/ext/_cobsr_ext.c +1 -1
- {cobs-1.2.2 → cobs-1.2.3}/LICENSE.txt +0 -0
- {cobs-1.2.2 → cobs-1.2.3}/MANIFEST.in +0 -0
- {cobs-1.2.2 → cobs-1.2.3}/README.rst +0 -0
- {cobs-1.2.2 → cobs-1.2.3}/cobs.egg-info/SOURCES.txt +0 -0
- {cobs-1.2.2 → cobs-1.2.3}/cobs.egg-info/dependency_links.txt +0 -0
- {cobs-1.2.2 → cobs-1.2.3}/cobs.egg-info/top_level.txt +0 -0
- {cobs-1.2.2 → cobs-1.2.3}/setup.cfg +0 -0
- {cobs-1.2.2 → cobs-1.2.3}/src/cobs/__init__.py +0 -0
- {cobs-1.2.2 → cobs-1.2.3}/src/cobs/cobs/__init__.py +0 -0
- {cobs-1.2.2 → cobs-1.2.3}/src/cobs/cobs/_cobs_py.py +0 -0
- {cobs-1.2.2 → cobs-1.2.3}/src/cobs/cobsr/__init__.py +0 -0
- {cobs-1.2.2 → cobs-1.2.3}/src/cobs/cobsr/_cobsr_py.py +0 -0
- {cobs-1.2.2 → cobs-1.2.3}/test/test_cobs.py +0 -0
- {cobs-1.2.2 → cobs-1.2.3}/test/test_cobsr.py +0 -0
|
@@ -175,6 +175,14 @@ class InputTypesTest(unittest.TestCase):
|
|
|
175
175
|
decoded = cobs.decode(array_encoded_string)
|
|
176
176
|
self.assertEqual(decoded, test_string)
|
|
177
177
|
|
|
178
|
+
def test_memoryview(self):
|
|
179
|
+
"""Test that memoryview objects can be encoded or decoded."""
|
|
180
|
+
for (test_string, expected_encoded_string) in self.predefined_encodings:
|
|
181
|
+
encoded = cobs.encode(memoryview(test_string))
|
|
182
|
+
self.assertEqual(encoded, expected_encoded_string)
|
|
183
|
+
decoded = cobs.decode(memoryview(expected_encoded_string))
|
|
184
|
+
self.assertEqual(decoded, test_string)
|
|
185
|
+
|
|
178
186
|
def test_array_of_half_words(self):
|
|
179
187
|
"""Test that array of half-word objects (array('H', ...)) are not encoded or decoded.
|
|
180
188
|
They should raise a BufferError."""
|
|
@@ -208,6 +208,14 @@ class InputTypesTest(unittest.TestCase):
|
|
|
208
208
|
decoded = cobsr.decode(array_encoded_string)
|
|
209
209
|
self.assertEqual(decoded, test_string)
|
|
210
210
|
|
|
211
|
+
def test_memoryview(self):
|
|
212
|
+
"""Test that memoryview objects can be encoded or decoded."""
|
|
213
|
+
for (test_string, expected_encoded_string) in self.predefined_encodings:
|
|
214
|
+
encoded = cobsr.encode(memoryview(test_string))
|
|
215
|
+
self.assertEqual(encoded, expected_encoded_string)
|
|
216
|
+
decoded = cobsr.decode(memoryview(expected_encoded_string))
|
|
217
|
+
self.assertEqual(decoded, test_string)
|
|
218
|
+
|
|
211
219
|
def test_array_of_half_words(self):
|
|
212
220
|
"""Test that array of half-word objects (array('H', ...)) are not encoded or decoded.
|
|
213
221
|
They should raise a BufferError."""
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"object supporting the buffer API is required"); \
|
|
62
62
|
return NULL; \
|
|
63
63
|
} \
|
|
64
|
-
if (PyObject_GetBuffer((obj), (viewp),
|
|
64
|
+
if (PyObject_GetBuffer((obj), (viewp), PyBUF_ND) == -1) { \
|
|
65
65
|
return NULL; \
|
|
66
66
|
} \
|
|
67
67
|
if (((viewp)->ndim > 1) || ((viewp)->itemsize > 1)) { \
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"object supporting the buffer API is required"); \
|
|
62
62
|
return NULL; \
|
|
63
63
|
} \
|
|
64
|
-
if (PyObject_GetBuffer((obj), (viewp),
|
|
64
|
+
if (PyObject_GetBuffer((obj), (viewp), PyBUF_ND) == -1) { \
|
|
65
65
|
return NULL; \
|
|
66
66
|
} \
|
|
67
67
|
if (((viewp)->ndim > 1) || ((viewp)->itemsize > 1)) { \
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|