From 480798a6309f3c81c4909a6af40f16411c98383a Mon Sep 17 00:00:00 2001 From: Vitja Makarov Date: Sun, 31 Jul 2011 14:03:12 +0400 Subject: [PATCH] Add generic python args test --- tests/errors/w_unused.pyx | 5 ++++ tests/run/unused_args.pyx | 53 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 tests/run/unused_args.pyx diff --git a/tests/errors/w_unused.pyx b/tests/errors/w_unused.pyx index 8024e81ce..b3c1581a0 100644 --- a/tests/errors/w_unused.pyx +++ b/tests/errors/w_unused.pyx @@ -35,6 +35,9 @@ def unused_and_unassigned(): cdef object foo cdef int i +def unused_generic(*args, **kwargs): + pass + _ERRORS = """ 6:6: Unused entry 'a' 9:9: Unused entry 'b' @@ -44,4 +47,6 @@ _ERRORS = """ 25:4: Unused entry 'Unused' 35:16: Unused entry 'foo' 36:13: Unused entry 'i' +38:20: Unused argument 'args' +38:28: Unused argument 'kwargs' """ diff --git a/tests/run/unused_args.pyx b/tests/run/unused_args.pyx new file mode 100644 index 000000000..7bb4b60e6 --- /dev/null +++ b/tests/run/unused_args.pyx @@ -0,0 +1,53 @@ +cdef c_unused_simple(a, b, c): + """ + >>> c_unused_simple(1, 2, 3) + 3 + """ + return a + b + +cdef c_unused_optional(a, b, c=1, d=2): + """ + >>> c_unused_optional(1, 2) + 4 + >>> c_unused_optional(1, 2, 3, 4) + 6 + """ + return b + d + +cpdef cp_unused_simple(a, b, c): + """ + >>> cp_unused_simple(1, 2, 3) + 3 + """ + return a + b + +cpdef cp_unused_optional(a, b, c=1, d=2): + """ + >>> cp_unused_optional(1, 2) + 4 + >>> cp_unused_optional(1, 2, 3, 4) + 6 + """ + return b + d + + +cdef class Unused: + """ + >>> o = Unused() + """ + + cpdef cp_unused_simple(self, a, b, c): + return c + + cpdef cp_unused_optional(self, a, b, c=1, d=2): + return b + d + +def def_unused(a, b, c): + """ + >>> def_unused(1, 2, 3) + """ + +def def_unused_metho(o): + """ + >>> def_unused_metho(0) + """ -- 2.25.1