diff options
author | Armin Rigo <arigo@tunes.org> | 2020-12-06 20:22:33 +0100 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2020-12-06 20:22:33 +0100 |
commit | faf9d0105c905753cb69952f028e507f8353a287 (patch) | |
tree | 27b8995843d79c4a202e3275e26563d32d36f0b7 /extra_tests | |
parent | move "thread from "requires" to "suggested" for sandbox, compatibility with p... (diff) | |
download | pypy-faf9d0105c905753cb69952f028e507f8353a287.tar.gz pypy-faf9d0105c905753cb69952f028e507f8353a287.tar.bz2 pypy-faf9d0105c905753cb69952f028e507f8353a287.zip |
update to cffi/023e2f33ee07
Diffstat (limited to 'extra_tests')
-rw-r--r-- | extra_tests/cffi_tests/cffi0/test_version.py | 7 | ||||
-rw-r--r-- | extra_tests/cffi_tests/cffi1/test_re_python.py | 5 | ||||
-rw-r--r-- | extra_tests/cffi_tests/test_c.py | 4 |
3 files changed, 13 insertions, 3 deletions
diff --git a/extra_tests/cffi_tests/cffi0/test_version.py b/extra_tests/cffi_tests/cffi0/test_version.py index f5f8d7f3b1..047402541d 100644 --- a/extra_tests/cffi_tests/cffi0/test_version.py +++ b/extra_tests/cffi_tests/cffi0/test_version.py @@ -37,7 +37,12 @@ def test_doc_version_file(): v = cffi.__version__.replace('+', '') p = os.path.join(parent, 'doc', 'source', 'installation.rst') content = open(p).read() - assert (" package version %s:" % v) in content + if " package version %s:" % v not in content: + for i in range(5): + if " package version %s-%d:" % (v, i) in content: + break + else: + assert 0, "doc/source/installation.rst needs updating" def test_setup_version(): parent = os.path.dirname(os.path.dirname(cffi.__file__)) diff --git a/extra_tests/cffi_tests/cffi1/test_re_python.py b/extra_tests/cffi_tests/cffi1/test_re_python.py index a14251cc70..1823ea5e38 100644 --- a/extra_tests/cffi_tests/cffi1/test_re_python.py +++ b/extra_tests/cffi_tests/cffi1/test_re_python.py @@ -75,6 +75,7 @@ def setup_module(mod): int strlen(const char *); struct with_union { union { int a; char b; }; }; union with_struct { struct { int a; char b; }; }; + struct with_struct_with_union { struct { union { int x; }; } cp; }; struct NVGcolor { union { float rgba[4]; struct { float r,g,b,a; }; }; }; typedef struct selfref { struct selfref *next; } *selfref_ptr_t; """) @@ -249,6 +250,10 @@ def test_anonymous_union_inside_struct(): assert ffi.offsetof("union with_struct", "b") == INT assert ffi.sizeof("union with_struct") >= INT + 1 # + assert ffi.sizeof("struct with_struct_with_union") == INT + p = ffi.new("struct with_struct_with_union *") + assert p.cp.x == 0 + # FLOAT = ffi.sizeof("float") assert ffi.sizeof("struct NVGcolor") == FLOAT * 4 assert ffi.offsetof("struct NVGcolor", "rgba") == 0 diff --git a/extra_tests/cffi_tests/test_c.py b/extra_tests/cffi_tests/test_c.py index 643cc904ee..d039edf00d 100644 --- a/extra_tests/cffi_tests/test_c.py +++ b/extra_tests/cffi_tests/test_c.py @@ -17,7 +17,7 @@ from _cffi_backend import __version__ # ____________________________________________________________ import sys -assert __version__ == "1.14.3", ("This test_c.py file is for testing a version" +assert __version__ == "1.14.4", ("This test_c.py file is for testing a version" " of cffi that differs from the one that we" " get from 'import _cffi_backend'") if sys.version_info < (3,): @@ -1470,7 +1470,7 @@ def test_a_lot_of_callbacks(): def make_callback(m): def cb(n): return n + m - return callback(BFunc, cb, 42) # 'cb' and 'BFunc' go out of scope + return callback(BFunc, cb, 42) # 'cb' goes out of scope # flist = [make_callback(i) for i in range(BIGNUM)] for i, f in enumerate(flist): |