Issue1153003

classification
Title: ArgParser - keyword parameter was given by position
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: bzimmer Nosy List: bzimmer, johahn
Priority: normal Keywords: patch

Created on 2005-02-27.19:23:22 by johahn, last changed 2005-03-01.01:34:13 by bzimmer.

Files
File name Uploaded Description Edit Remove
ArgParser.patch johahn, 2005-02-27.19:23:22 detect and prevent position and keyword duplication
Messages
msg2427 (view) Author: Johan M. Hahn (johahn) Date: 2005-02-27.19:23:22
Before:
>>> complex(3, real=5)
(3+0j)

After:
>>> complex(3, real=5)
Traceback (innermost last):
  File "<console>", line 1, in ?
TypeError: keyword parameter 'real' was given by position 
and by name

(This example assumes that my patch for complex be 
applied first.)
msg2428 (view) Author: Brian Zimmer (bzimmer) Date: 2005-02-28.05:52:07
Logged In: YES 
user_id=37674

Can you please provide a simple unittest for this patch so I can include 
in the testsuite?

thanks, brian
msg2429 (view) Author: Johan M. Hahn (johahn) Date: 2005-02-28.11:25:17
Logged In: YES 
user_id=887415

Did you mean a bugtest? Anyway, here is one.
If you really meant a unittest please point me to the correct 
directory to implement it as I didn't found a suitable one 
(python/Lib/bugs ?).

<code>
"""
test for patch [ 1153003 ]
"""

import support
import jarray
import java
from org.python.core import ArgParser, PyObject

try:
    # test(1, arg1=2)
    args = jarray.array([1,2], PyObject)
    kwds = jarray.array(['arg1'], java.lang.String)
    ArgParser('test', args, kwds, 'arg1', 'arg2')
except TypeError:
    pass
else:
    raise support.TestError('Should raise a TypeError')

</code>
msg2430 (view) Author: Brian Zimmer (bzimmer) Date: 2005-03-01.01:34:13
Logged In: YES 
user_id=37674

This works just fine.  We have no real unittest framework but this test will 
be perfect, thanks.
History
Date User Action Args
2005-02-27 19:23:22johahncreate