a :jg$ @sTdZddlZddlZddlmZddZddZdd Z d d Z d d Z ddZ dS)a Tests for the private NumPy argument parsing functionality. They mainly exists to ensure good test coverage without having to try the weirder cases on actual numpy functions but test them in one place. The test function is defined in C to be equivalent to (errors may not always match exactly, and could be adjusted): def func(arg1, /, arg2, *, arg3): i = integer(arg1) # reproducing the 'i' parsing in Python. return None N)argparse_example_functioncCsptjtddtdWdn1s,0YtttddWdn1sb0YdS)Nz$integer argument expected, got floatmatchg?d)pytestraises TypeErrorfunc OverflowErrorr r I/usr/local/lib/python3.9/site-packages/numpy/_core/tests/test_argparse.pytest_invalid_integerss & rcCstjtddtWdn1s*0YtjtddtdddWdn1sd0YtjtddtdddWdn1s0YdS) Nz&missing required positional argument 0r)arg2arg3z,missing required argument \'arg2\' \(pos 1\))rrrr r r r r r test_missing_argumentss$*rcCs@tjtddtddddWdn1s20YdS)Nz7takes from 2 to 3 positional arguments but 4 were givenrrrrrr r r r test_too_many_positional(srcCs@tjtddtddddWdn1s20YdS)Nz4given by name \('arg2'\) and position \(position 1\)rrrr)rrr r r r test_multiple_values/srcCsjtd}td}tdi|ditjtdd"td i|diWdn1s\0YdS) Nr missing_argrrz0got an unexpected keyword argument 'missing_arg'rr)r)r)npZstr_r rrr )rrr r r test_string_fallbacks5s  rcCsJtd}td}tt|j|Wdn1s<0YdS)Nri)rZarangerangerrr mean)Zarrargsr r r )test_too_many_arguments_method_forwarding@s  r) __doc__rnumpyrZnumpy._core._multiarray_testsrr rrrrrrr r r r s