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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cobs
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Consistent Overhead Byte Stuffing (COBS)
5
5
  Author-email: Craig McQueen <python@craig.mcqueen.id.au>
6
6
  License: ----------------------------------------------------------------------------
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cobs
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Consistent Overhead Byte Stuffing (COBS)
5
5
  Author-email: Craig McQueen <python@craig.mcqueen.id.au>
6
6
  License: ----------------------------------------------------------------------------
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cobs"
7
- version = "1.2.2"
7
+ version = "1.2.3"
8
8
  authors = [
9
9
  { name = "Craig McQueen", email = "python@craig.mcqueen.id.au" },
10
10
  ]
@@ -9,7 +9,7 @@ if sys.version_info[0] == 2:
9
9
 
10
10
  setup_dict = dict(
11
11
  name="cobs",
12
- version="1.2.2",
12
+ version="1.2.3",
13
13
  packages=[ 'cobs', 'cobs.cobs', 'cobs.cobsr', 'cobs._version', ],
14
14
  package_dir={
15
15
  'cobs' : 'src/cobs',
@@ -14,7 +14,7 @@ __all__ = [
14
14
 
15
15
  VERSION_MAJOR = 1
16
16
  VERSION_MINOR = 2
17
- VERSION_PATCH = 1
17
+ VERSION_PATCH = 3
18
18
 
19
19
  VERSION_STRING = '%s.%s.%s' % (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
20
20
 
@@ -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), PyBUF_FORMAT) == -1) { \
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), PyBUF_FORMAT) == -1) { \
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