pysipp icon indicating copy to clipboard operation
pysipp copied to clipboard

Validating pysipp.clien() args at construction time

Open oza4h07 opened this issue 3 years ago • 3 comments

Hello,

Using latest pysipp (with sipp 3.5.2):

import pysipp
uac = pysipp.client(invalid_arg='foo')

Is there a way to trigger an error or warning when passing an invalid argument ? Best regards

oza4h07 avatar May 27 '22 17:05 oza4h07

Ahh good catch. Yeah we should probably have an arg validator 😂

I'm kind of surprised this doesn't error.

@oza4h07 would you mind writing a simple test for this and then we can get a patch in?

goodboy avatar May 27 '22 17:05 goodboy

I'll try to write such test in the coming days ... Thanks for looking at this !

oza4h07 avatar May 30 '22 06:05 oza4h07

@oza4h07 no problema amigo.

I think our main issue is going to be that all the option keys are currently defined inside strings in our sipp_spec: list[Union[str, Field]] thing.

Looking at the code it seems like it should already be raising an error:

I would try adjusting line 121 to be above line 119 and see if that catches this. Only question is if it will break everything else 😂

goodboy avatar May 30 '22 14:05 goodboy