diff options
| author | Armin Rigo <arigo@tunes.org> | 2017-02-06 09:33:59 +0100 |
|---|---|---|
| committer | Armin Rigo <arigo@tunes.org> | 2017-02-06 09:33:59 +0100 |
| commit | 0e4e34033dcbe9d4ff4070e5754fac392d79fff3 (patch) | |
| tree | b46616818befa2139fe15ece4e05b2bcb78c9086 /testing | |
| parent | 2ad2c47b3b76da0d683cd5bb5c404ff7100b535b (diff) | |
| download | cffi-0e4e34033dcbe9d4ff4070e5754fac392d79fff3.tar.gz | |
Remove a warning that doesn't really make sense here, tweak tests
Diffstat (limited to 'testing')
| -rw-r--r-- | testing/cffi0/backend_tests.py | 5 | ||||
| -rw-r--r-- | testing/cffi0/test_ffi_backend.py | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/testing/cffi0/backend_tests.py b/testing/cffi0/backend_tests.py index cf25512..a72e5c9 100644 --- a/testing/cffi0/backend_tests.py +++ b/testing/cffi0/backend_tests.py @@ -1229,17 +1229,20 @@ class BackendTests: def test_ffi_buffer_comparisons(self): ffi = FFI(backend=self.Backend()) ba = bytearray(range(100, 110)) + assert ba == memoryview(ba) # justification for the following a = ffi.new("uint8_t[]", list(ba)) + c = ffi.new("uint8_t[]", [99] + list(ba)) try: b_full = ffi.buffer(a) b_short = ffi.buffer(a, 3) b_mid = ffi.buffer(a, 6) + b_other = ffi.buffer(c, 6) except NotImplementedError as e: py.test.skip(str(e)) else: content = b_full[:] assert content == b_full == ba - assert b_short < b_mid < b_full + assert b_other < b_short < b_mid < b_full assert ba > b_mid > ba[0:2] assert b_short != ba[1:4] diff --git a/testing/cffi0/test_ffi_backend.py b/testing/cffi0/test_ffi_backend.py index b387adb..458e629 100644 --- a/testing/cffi0/test_ffi_backend.py +++ b/testing/cffi0/test_ffi_backend.py @@ -191,8 +191,11 @@ class TestBitfield: s = ffi.new("struct s1 *") setattr(s, name, value) assert getattr(s, name) == value + raw1 = ffi.buffer(s)[:] buff1 = ffi.buffer(s) t = lib.try_with_value(fnames.index(name), value) + raw2 = ffi.buffer(t, len(raw1))[:] + assert raw1 == raw2 buff2 = ffi.buffer(t, len(buff1)) assert buff1 == buff2 |
