From d8efb40401e4aa3b4401d820387a1c9211ec2cb1 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Mon, 26 May 2008 10:22:09 +0200 Subject: [PATCH] test cases for optional arguments in cdef functions --- tests/errors/cdefoptargs.pyx | 9 +++++++++ tests/run/cdefoptargs.pyx | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 tests/errors/cdefoptargs.pyx create mode 100644 tests/run/cdefoptargs.pyx diff --git a/tests/errors/cdefoptargs.pyx b/tests/errors/cdefoptargs.pyx new file mode 100644 index 00000000..c7ac4804 --- /dev/null +++ b/tests/errors/cdefoptargs.pyx @@ -0,0 +1,9 @@ +def call5(): + b(1,2,3,4,5) + +cdef b(a, b, c=1, d=2): + pass + +_ERRORS = """ +2:5:Call with wrong number of arguments (expected at most 4, got 5) +""" diff --git a/tests/run/cdefoptargs.pyx b/tests/run/cdefoptargs.pyx new file mode 100644 index 00000000..366a18d3 --- /dev/null +++ b/tests/run/cdefoptargs.pyx @@ -0,0 +1,21 @@ +__doc__ = u""" + >>> call2() + >>> call3() + >>> call4() +""" + +# the calls: + +def call2(): + b(1,2) + +def call3(): + b(1,2,3) + +def call4(): + b(1,2,3,4) + +# the called function: + +cdef b(a, b, c=1, d=2): + pass -- 2.26.2