diff options
Diffstat (limited to 'testing/cffi1/test_recompiler.py')
-rw-r--r-- | testing/cffi1/test_recompiler.py | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py index fdb4d5a..362a372 100644 --- a/testing/cffi1/test_recompiler.py +++ b/testing/cffi1/test_recompiler.py @@ -1,5 +1,5 @@ -import sys, os, py +import sys, os import pytest from cffi import FFI, VerificationError, FFIError, CDefError from cffi import recompiler @@ -45,8 +45,8 @@ def verify(ffi, module_name, source, *args, **kwds): def test_set_source_no_slashes(): ffi = FFI() - py.test.raises(ValueError, ffi.set_source, "abc/def", None) - py.test.raises(ValueError, ffi.set_source, "abc/def", "C code") + pytest.raises(ValueError, ffi.set_source, "abc/def", None) + pytest.raises(ValueError, ffi.set_source, "abc/def", "C code") def test_type_table_func(): @@ -250,7 +250,7 @@ def test_macro_check_value(): x = getattr(lib, attrname) assert x == c_got else: - e = py.test.raises(ffi.error, getattr, lib, attrname) + e = pytest.raises(ffi.error, getattr, lib, attrname) assert str(e.value) == ( "the C compiler says '%s' is equal to " "%s, but the cdef disagrees" % (attrname, c_compiler_msg)) @@ -268,7 +268,7 @@ def test_check_value_of_static_const(): ffi.cdef("static const int FOOBAR = 042;") lib = verify(ffi, 'test_check_value_of_static_const', "#define FOOBAR (-6912)") - e = py.test.raises(ffi.error, getattr, lib, 'FOOBAR') + e = pytest.raises(ffi.error, getattr, lib, 'FOOBAR') assert str(e.value) == ( "the C compiler says 'FOOBAR' is equal to -6912, but the cdef disagrees") @@ -341,7 +341,7 @@ def test_verify_struct(): assert ffi.offsetof("struct foo_s", "b") == 4 assert ffi.offsetof(u+"struct foo_s", u+"b") == 4 # - py.test.raises(TypeError, ffi.addressof, p) + pytest.raises(TypeError, ffi.addressof, p) assert ffi.addressof(p[0]) == p assert ffi.typeof(ffi.addressof(p[0])) is ffi.typeof("struct foo_s *") assert ffi.typeof(ffi.addressof(p, "b")) is ffi.typeof("int *") @@ -352,7 +352,7 @@ def test_verify_exact_field_offset(): ffi.cdef("""struct foo_s { int b; short a; };""") lib = verify(ffi, 'test_verify_exact_field_offset', """struct foo_s { short a; int b; };""") - e = py.test.raises(ffi.error, ffi.new, "struct foo_s *", []) # lazily + e = pytest.raises(ffi.error, ffi.new, "struct foo_s *", []) # lazily assert str(e.value).startswith( "struct foo_s: wrong offset for field 'b' (cdef " 'says 0, but C compiler says 4). fix it or use "...;" ') @@ -393,7 +393,7 @@ def test_verify_enum(): def test_duplicate_enum(): ffi = FFI() ffi.cdef("enum e1 { A1, ... }; enum e2 { A1, ... };") - py.test.raises(VerificationError, verify, ffi, 'test_duplicate_enum', + pytest.raises(VerificationError, verify, ffi, 'test_duplicate_enum', "enum e1 { A1 }; enum e2 { B1 };") def test_dotdotdot_length_of_array_field(): @@ -463,7 +463,7 @@ def test_math_sin_type(): assert ffi.typeof(lib.sin).cname == "double(*)(double)" # 'x' is another <built-in method> object on lib, made very indirectly x = type(lib).__dir__.__get__(lib) - py.test.raises(TypeError, ffi.typeof, x) + pytest.raises(TypeError, ffi.typeof, x) # # present on built-in functions on CPython; must be emulated on PyPy: assert lib.sin.__name__ == 'sin' @@ -567,13 +567,13 @@ def test_module_name_in_package(): def test_bad_size_of_global_1(): ffi = FFI() ffi.cdef("extern short glob;") - py.test.raises(VerificationError, verify, ffi, + pytest.raises(VerificationError, verify, ffi, "test_bad_size_of_global_1", "long glob;") def test_bad_size_of_global_2(): ffi = FFI() ffi.cdef("extern int glob[10];") - py.test.raises(VerificationError, verify, ffi, + pytest.raises(VerificationError, verify, ffi, "test_bad_size_of_global_2", "int glob[9];") def test_unspecified_size_of_global_1(): @@ -737,7 +737,7 @@ def test_include_8(): ffi.include(ffi1) ffi.cdef("struct foo_s { int x, y; };") verify(ffi, "test_include_8", "struct foo_s { int x, y; };") - e = py.test.raises(NotImplementedError, ffi.new, "struct foo_s *") + e = pytest.raises(NotImplementedError, ffi.new, "struct foo_s *") assert str(e.value) == ( "'struct foo_s' is opaque in the ffi.include(), but no longer in " "the ffi doing the include (workaround: don't use ffi.include() but" @@ -747,7 +747,7 @@ def test_unicode_libraries(): try: unicode except NameError: - py.test.skip("for python 2.x") + pytest.skip("for python 2.x") # import math lib_m = "m" @@ -848,8 +848,8 @@ def test_address_of_global_var(): assert ffi.typeof(p) == ffi.typeof("long(*)[2]") assert p[0] == lib.bottoms # - py.test.raises(AttributeError, ffi.addressof, lib, 'unknown_var') - py.test.raises(AttributeError, ffi.addressof, lib, "FOOBAR") + pytest.raises(AttributeError, ffi.addressof, lib, 'unknown_var') + pytest.raises(AttributeError, ffi.addressof, lib, "FOOBAR") def test_defines__CFFI_(): # Check that we define the macro _CFFI_ automatically. @@ -880,13 +880,13 @@ def test_unpack_args(): lib.foo0() lib.foo1(42) lib.foo2(43, 44) - e1 = py.test.raises(TypeError, lib.foo0, 42) - e2 = py.test.raises(TypeError, lib.foo0, 43, 44) - e3 = py.test.raises(TypeError, lib.foo1) - e4 = py.test.raises(TypeError, lib.foo1, 43, 44) - e5 = py.test.raises(TypeError, lib.foo2) - e6 = py.test.raises(TypeError, lib.foo2, 42) - e7 = py.test.raises(TypeError, lib.foo2, 45, 46, 47) + e1 = pytest.raises(TypeError, lib.foo0, 42) + e2 = pytest.raises(TypeError, lib.foo0, 43, 44) + e3 = pytest.raises(TypeError, lib.foo1) + e4 = pytest.raises(TypeError, lib.foo1, 43, 44) + e5 = pytest.raises(TypeError, lib.foo2) + e6 = pytest.raises(TypeError, lib.foo2, 42) + e7 = pytest.raises(TypeError, lib.foo2, 45, 46, 47) def st1(s): s = str(s) if s.startswith("_CFFI_test_unpack_args.Lib."): @@ -971,7 +971,7 @@ def test_constant_of_unknown_size(): lib = verify(ffi, 'test_constant_of_unknown_size', "typedef int opaque_t;" "const int CONSTANT = 42;") - e = py.test.raises(ffi.error, getattr, lib, 'CONSTANT') + e = pytest.raises(ffi.error, getattr, lib, 'CONSTANT') assert str(e.value) == ("constant 'CONSTANT' is of " "type 'opaque_t', whose size is not known") @@ -986,10 +986,10 @@ def test_variable_of_unknown_size(): opaque_t globvar = "hello"; """) # can't read or write it at all - e = py.test.raises(TypeError, getattr, lib, 'globvar') + e = pytest.raises(TypeError, getattr, lib, 'globvar') assert str(e.value) in ["cdata 'opaque_t' is opaque", "'opaque_t' is opaque or not completed yet"] #pypy - e = py.test.raises(TypeError, setattr, lib, 'globvar', []) + e = pytest.raises(TypeError, setattr, lib, 'globvar', []) assert str(e.value) in ["'opaque_t' is opaque", "'opaque_t' is opaque or not completed yet"] #pypy # but we can get its address @@ -1132,9 +1132,9 @@ def test_some_integer_type(): assert lib.foobar(2 ** 15 - 1, [0, 0]) == 2 ** 15 - 1 assert lib.foobar(10, [20, 31]) == 61 assert lib.foobar(0, [0, maxulonglong]) == maxulonglong - py.test.raises(OverflowError, lib.foobar, 2 ** 15, [0, 0]) - py.test.raises(OverflowError, lib.foobar, -(2 ** 15) - 1, [0, 0]) - py.test.raises(OverflowError, ffi.new, "mystruct_t *", [0, -1]) + pytest.raises(OverflowError, lib.foobar, 2 ** 15, [0, 0]) + pytest.raises(OverflowError, lib.foobar, -(2 ** 15) - 1, [0, 0]) + pytest.raises(OverflowError, ffi.new, "mystruct_t *", [0, -1]) assert lib.mu == -20 assert lib.nu == 20 @@ -1160,7 +1160,7 @@ def test_some_float_type(): def test_some_float_invalid_1(): ffi = FFI() - py.test.raises((FFIError, # with pycparser <= 2.17 + pytest.raises((FFIError, # with pycparser <= 2.17 CDefError), # with pycparser >= 2.18 ffi.cdef, "typedef long double... foo_t;") @@ -1171,7 +1171,7 @@ def test_some_float_invalid_2(): typedef unsigned long foo_t; foo_t neg(foo_t x) { return -x; } """) - e = py.test.raises(ffi.error, getattr, lib, 'neg') + e = pytest.raises(ffi.error, getattr, lib, 'neg') assert str(e.value) == ("primitive floating-point type with an unexpected " "size (or not a float type at all)") @@ -1185,7 +1185,7 @@ def test_some_float_invalid_3(): if ffi.sizeof("long double") == ffi.sizeof("double"): assert lib.neg(12.3) == -12.3 else: - e = py.test.raises(ffi.error, getattr, lib, 'neg') + e = pytest.raises(ffi.error, getattr, lib, 'neg') assert str(e.value) == ("primitive floating-point type is " "'long double', not supported for now with " "the syntax 'typedef double... xxx;'") @@ -1267,15 +1267,15 @@ def test_macro_var_callback(): def get_my_value(): raise LookupError lib.get_my_value = get_my_value - py.test.raises(ffi.error, getattr, lib, 'my_value') - py.test.raises(ffi.error, setattr, lib, 'my_value', 50) - py.test.raises(ffi.error, ffi.addressof, lib, 'my_value') + pytest.raises(ffi.error, getattr, lib, 'my_value') + pytest.raises(ffi.error, setattr, lib, 'my_value', 50) + pytest.raises(ffi.error, ffi.addressof, lib, 'my_value') @ffi.callback("int *(*)(void)") def get_my_value(): return "hello" lib.get_my_value = get_my_value - py.test.raises(ffi.error, getattr, lib, 'my_value') - e = py.test.raises(ffi.error, setattr, lib, 'my_value', 50) + pytest.raises(ffi.error, getattr, lib, 'my_value') + e = pytest.raises(ffi.error, setattr, lib, 'my_value', 50) assert str(e.value) == "global variable 'my_value' is at address NULL" def test_const_fields(): @@ -1417,8 +1417,8 @@ def test_win32_calling_convention_0(): if sys.platform == 'win32' and not sys.maxsize > 2**32: assert '__stdcall' in str(ffi.typeof(cb2)) assert '__stdcall' not in str(ffi.typeof(cb1)) - py.test.raises(TypeError, lib.call1, cb2) - py.test.raises(TypeError, lib.call2, cb1) + pytest.raises(TypeError, lib.call1, cb2) + pytest.raises(TypeError, lib.call2, cb1) else: assert '__stdcall' not in str(ffi.typeof(cb2)) assert ffi.typeof(cb2) is ffi.typeof(cb1) @@ -1503,10 +1503,10 @@ def test_win32_calling_convention_2(): ptr_call1 = ffi.addressof(lib, 'call1') ptr_call2 = ffi.addressof(lib, 'call2') if sys.platform == 'win32' and not sys.maxsize > 2**32: - py.test.raises(TypeError, lib.call1, ffi.addressof(lib, 'cb2')) - py.test.raises(TypeError, ptr_call1, ffi.addressof(lib, 'cb2')) - py.test.raises(TypeError, lib.call2, ffi.addressof(lib, 'cb1')) - py.test.raises(TypeError, ptr_call2, ffi.addressof(lib, 'cb1')) + pytest.raises(TypeError, lib.call1, ffi.addressof(lib, 'cb2')) + pytest.raises(TypeError, ptr_call1, ffi.addressof(lib, 'cb2')) + pytest.raises(TypeError, lib.call2, ffi.addressof(lib, 'cb1')) + pytest.raises(TypeError, ptr_call2, ffi.addressof(lib, 'cb1')) assert lib.call1(ffi.addressof(lib, 'cb1')) == 500*999*2 assert ptr_call1(ffi.addressof(lib, 'cb1')) == 500*999*2 assert lib.call2(ffi.addressof(lib, 'cb2')) == -500*999*3 @@ -1559,10 +1559,10 @@ def test_win32_calling_convention_3(): ptr_call1 = ffi.addressof(lib, 'call1') ptr_call2 = ffi.addressof(lib, 'call2') if sys.platform == 'win32' and not sys.maxsize > 2**32: - py.test.raises(TypeError, lib.call1, ffi.addressof(lib, 'cb2')) - py.test.raises(TypeError, ptr_call1, ffi.addressof(lib, 'cb2')) - py.test.raises(TypeError, lib.call2, ffi.addressof(lib, 'cb1')) - py.test.raises(TypeError, ptr_call2, ffi.addressof(lib, 'cb1')) + pytest.raises(TypeError, lib.call1, ffi.addressof(lib, 'cb2')) + pytest.raises(TypeError, ptr_call1, ffi.addressof(lib, 'cb2')) + pytest.raises(TypeError, lib.call2, ffi.addressof(lib, 'cb1')) + pytest.raises(TypeError, ptr_call2, ffi.addressof(lib, 'cb1')) pt = lib.call1(ffi.addressof(lib, 'cb1')) assert (pt.x, pt.y) == (-9*500*999, 9*500*999) pt = ptr_call1(ffi.addressof(lib, 'cb1')) @@ -1640,23 +1640,23 @@ def test_extern_python_bogus_name(): lib = verify(ffi, 'test_extern_python_bogus_name', "int abc;") def fn(): pass - py.test.raises(ffi.error, ffi.def_extern("unknown_name"), fn) - py.test.raises(ffi.error, ffi.def_extern("abc"), fn) + pytest.raises(ffi.error, ffi.def_extern("unknown_name"), fn) + pytest.raises(ffi.error, ffi.def_extern("abc"), fn) assert lib.abc == 0 - e = py.test.raises(ffi.error, ffi.def_extern("abc"), fn) + e = pytest.raises(ffi.error, ffi.def_extern("abc"), fn) assert str(e.value) == ("ffi.def_extern('abc'): no 'extern \"Python\"' " "function with this name") - e = py.test.raises(ffi.error, ffi.def_extern(), fn) + e = pytest.raises(ffi.error, ffi.def_extern(), fn) assert str(e.value) == ("ffi.def_extern('fn'): no 'extern \"Python\"' " "function with this name") # - py.test.raises(TypeError, ffi.def_extern(42), fn) - py.test.raises((TypeError, AttributeError), ffi.def_extern(), "foo") + pytest.raises(TypeError, ffi.def_extern(42), fn) + pytest.raises((TypeError, AttributeError), ffi.def_extern(), "foo") class X: pass x = X() x.__name__ = x - py.test.raises(TypeError, ffi.def_extern(), x) + pytest.raises(TypeError, ffi.def_extern(), x) def test_extern_python_bogus_result_type(): ffi = FFI() @@ -1755,8 +1755,8 @@ def test_extern_python_long_double(): def test_extern_python_signature(): ffi = FFI() lib = verify(ffi, 'test_extern_python_signature', "") - py.test.raises(TypeError, ffi.def_extern(425), None) - py.test.raises(TypeError, ffi.def_extern, 'a', 'b', 'c', 'd') + pytest.raises(TypeError, ffi.def_extern(425), None) + pytest.raises(TypeError, ffi.def_extern, 'a', 'b', 'c', 'd') def test_extern_python_errors(): ffi = FFI() @@ -1790,7 +1790,7 @@ def test_extern_python_errors(): assert tb.tb_frame.f_code.co_name == "bar2" # # a case where 'onerror' is not callable - py.test.raises(TypeError, ffi.def_extern(name='bar', onerror=42), + pytest.raises(TypeError, ffi.def_extern(name='bar', onerror=42), lambda x: x) def test_extern_python_stdcall(): @@ -1996,31 +1996,31 @@ def test_bool_in_cpp_2(): def test_struct_field_opaque(): ffi = FFI() ffi.cdef("struct a { struct b b; };") - e = py.test.raises(TypeError, verify, + e = pytest.raises(TypeError, verify, ffi, "test_struct_field_opaque", "?") assert str(e.value) == ("struct a: field 'a.b' is of an opaque" " type (not declared in cdef())") ffi = FFI() ffi.cdef("struct a { struct b b[2]; };") - e = py.test.raises(TypeError, verify, + e = pytest.raises(TypeError, verify, ffi, "test_struct_field_opaque", "?") assert str(e.value) == ("struct a: field 'a.b' is of an opaque" " type (not declared in cdef())") ffi = FFI() ffi.cdef("struct a { struct b b[]; };") - e = py.test.raises(TypeError, verify, + e = pytest.raises(TypeError, verify, ffi, "test_struct_field_opaque", "?") assert str(e.value) == ("struct a: field 'a.b' is of an opaque" " type (not declared in cdef())") def test_function_arg_opaque(): - py.test.skip("can currently declare a function with an opaque struct " + pytest.skip("can currently declare a function with an opaque struct " "as argument, but AFAICT it's impossible to call it later") def test_function_returns_opaque(): ffi = FFI() ffi.cdef("struct a foo(int);") - e = py.test.raises(TypeError, verify, + e = pytest.raises(TypeError, verify, ffi, "test_function_returns_opaque", "?") assert str(e.value) == ("function foo: 'struct a' is used as result type," " but is opaque") @@ -2045,7 +2045,7 @@ def test_function_returns_partial_struct(): def test_function_returns_float_complex(): if sys.platform == 'win32': - py.test.skip("MSVC may not support _Complex") + pytest.skip("MSVC may not support _Complex") ffi = FFI() ffi.cdef("float _Complex f1(float a, float b);"); lib = verify(ffi, "test_function_returns_float_complex", """ @@ -2059,7 +2059,7 @@ def test_function_returns_float_complex(): def test_function_returns_double_complex(): if sys.platform == 'win32': - py.test.skip("MSVC may not support _Complex") + pytest.skip("MSVC may not support _Complex") ffi = FFI() ffi.cdef("double _Complex f1(double a, double b);"); lib = verify(ffi, "test_function_returns_double_complex", """ @@ -2073,7 +2073,7 @@ def test_function_returns_double_complex(): def test_function_argument_float_complex(): if sys.platform == 'win32': - py.test.skip("MSVC may not support _Complex") + pytest.skip("MSVC may not support _Complex") ffi = FFI() ffi.cdef("float f1(float _Complex x);"); lib = verify(ffi, "test_function_argument_float_complex", """ @@ -2086,7 +2086,7 @@ def test_function_argument_float_complex(): def test_function_argument_double_complex(): if sys.platform == 'win32': - py.test.skip("MSVC may not support _Complex") + pytest.skip("MSVC may not support _Complex") ffi = FFI() ffi.cdef("double f1(double _Complex);"); lib = verify(ffi, "test_function_argument_double_complex", """ @@ -2119,7 +2119,7 @@ def test_typedef_array_dotdotdot(): assert ffi.sizeof("mat_t") == 6 * 7 * ffi.sizeof("int") assert len(ffi.new("mat_t")) == 6 assert len(ffi.new("mat_t")[3]) == 7 - py.test.raises(ffi.error, ffi.sizeof, "vmat_t") + pytest.raises(ffi.error, ffi.sizeof, "vmat_t") p = ffi.new("vmat_t", 4) assert ffi.sizeof(p[3]) == 8 * ffi.sizeof("int") @@ -2173,7 +2173,7 @@ def test_call_with_custom_field_pos(): struct foo g(int a, ...) { return f(); } """) assert lib.f().x == 200 - e = py.test.raises(NotImplementedError, lib.g, 0) + e = pytest.raises(NotImplementedError, lib.g, 0) assert str(e.value) == ( 'ctype \'struct foo\' not supported as return value. It is a ' 'struct declared with "...;", but the C calling convention may ' @@ -2185,7 +2185,7 @@ def test_call_with_custom_field_pos(): def test_call_with_nested_anonymous_struct(): if sys.platform == 'win32': - py.test.skip("needs a GCC extension") + pytest.skip("needs a GCC extension") ffi = FFI() ffi.cdef(""" struct foo { int a; union { int b, c; }; }; @@ -2203,7 +2203,7 @@ def test_call_with_nested_anonymous_struct(): struct foo g(int a, ...) { return f(); } """) assert lib.f().b == 200 - e = py.test.raises(NotImplementedError, lib.g, 0) + e = pytest.raises(NotImplementedError, lib.g, 0) assert str(e.value) == ( 'ctype \'struct foo\' not supported as return value. It is a ' 'struct declared with "...;", but the C calling convention may ' @@ -2229,7 +2229,7 @@ def test_call_with_bitfield(): struct foo g(int a, ...) { return f(); } """) assert lib.f().x == 11 - e = py.test.raises(NotImplementedError, lib.g, 0) + e = pytest.raises(NotImplementedError, lib.g, 0) assert str(e.value) == ( "ctype 'struct foo' not supported as return value. It is a struct " "with bit fields, which libffi does not support. Such structs are " @@ -2239,7 +2239,7 @@ def test_call_with_bitfield(): def test_call_with_zero_length_field(): if sys.platform == 'win32': - py.test.skip("zero-length field not supported by MSVC") + pytest.skip("zero-length field not supported by MSVC") ffi = FFI() ffi.cdef(""" struct foo { int a; int x[0]; }; @@ -2255,7 +2255,7 @@ def test_call_with_zero_length_field(): struct foo g(int a, ...) { return f(); } """) assert lib.f().a == 42 - e = py.test.raises(NotImplementedError, lib.g, 0) + e = pytest.raises(NotImplementedError, lib.g, 0) assert str(e.value) == ( "ctype 'struct foo' not supported as return value. It is a " "struct with a zero-length array, which libffi does not support." @@ -2279,7 +2279,7 @@ def test_call_with_union(): union foo g(int a, ...) { return f(); } """) assert lib.f().a == 42 - e = py.test.raises(NotImplementedError, lib.g, 0) + e = pytest.raises(NotImplementedError, lib.g, 0) assert str(e.value) == ( "ctype 'union foo' not supported as return value by libffi. " "Unions are only supported as return value if the function is " @@ -2288,7 +2288,7 @@ def test_call_with_union(): def test_call_with_packed_struct(): if sys.platform == 'win32': - py.test.skip("needs a GCC extension") + pytest.skip("needs a GCC extension") ffi = FFI() ffi.cdef(""" struct foo { char y; int x; }; @@ -2308,7 +2308,7 @@ def test_call_with_packed_struct(): """) assert ord(lib.f().y) == 40 assert lib.f().x == 200 - e = py.test.raises(NotImplementedError, lib.g, 0) + e = pytest.raises(NotImplementedError, lib.g, 0) assert str(e.value) == ( "ctype 'struct foo' not supported as return value. It is a " "'packed' structure, with a different layout than expected by libffi." @@ -2319,12 +2319,12 @@ def test_call_with_packed_struct(): def test_pack_not_supported(): ffi = FFI() ffi.cdef("""struct foo { char y; int x; };""", pack=2) - py.test.raises(NotImplementedError, verify, + pytest.raises(NotImplementedError, verify, ffi, "test_pack_not_supported", "") def test_gcc_visibility_hidden(): if sys.platform == 'win32': - py.test.skip("test for gcc/clang") + pytest.skip("test for gcc/clang") ffi = FFI() ffi.cdef(""" int f(int); @@ -2342,7 +2342,7 @@ def test_override_default_definition(): def test_char16_char32_type(no_cpp=False): if no_cpp is False and sys.platform == "win32": - py.test.skip("aaaaaaa why do modern MSVC compilers still define " + pytest.skip("aaaaaaa why do modern MSVC compilers still define " "a very old __cplusplus value") ffi = FFI() ffi.cdef(""" @@ -2361,9 +2361,9 @@ def test_char16_char32_type(no_cpp=False): assert lib.foo_2bytes(u+'\u1234') == u+'\u125e' assert lib.foo_4bytes(u+'\u1234') == u+'\u125e' assert lib.foo_4bytes(u+'\U00012345') == u+'\U0001236f' - py.test.raises(TypeError, lib.foo_2bytes, u+'\U00012345') - py.test.raises(TypeError, lib.foo_2bytes, 1234) - py.test.raises(TypeError, lib.foo_4bytes, 1234) + pytest.raises(TypeError, lib.foo_2bytes, u+'\U00012345') + pytest.raises(TypeError, lib.foo_2bytes, 1234) + pytest.raises(TypeError, lib.foo_4bytes, 1234) def test_char16_char32_plain_c(): test_char16_char32_type(no_cpp=True) @@ -2384,7 +2384,7 @@ def test_realize_struct_error(): lib = verify(ffi, "test_realize_struct_error", """ typedef int foo_t; struct foo_s { void (*x)(foo_t); }; """) - py.test.raises(TypeError, ffi.new, "struct foo_s *") + pytest.raises(TypeError, ffi.new, "struct foo_s *") def test_from_buffer_struct(): ffi = FFI() @@ -2482,7 +2482,7 @@ def test_struct_with_func_with_struct_arg(): int (* CompareKey)(struct BinaryTree tree); }; """) - py.test.raises(RuntimeError, ffi.new, "struct BinaryTree *") + pytest.raises(RuntimeError, ffi.new, "struct BinaryTree *") def test_passing_large_list(): ffi = FFI() |