> there is no option to only accept existing keys. I'm not sure what they mean... there's a `raising` keyword argument, which defaults to True.
[] Bruno On Sun, Mar 21, 2021 at 2:41 PM Brian Okken <[email protected]> wrote: > I think I want to get some extra help on this good question. > - Brian > > - Brian > > Begin forwarded message: > > *From:* Dimitri Blyumin via Fireside <[email protected]> > *Date:* March 20, 2021 at 7:36:58 PM PDT > *To:* [email protected] > *Subject:* *[Test & Code : Python Testing] Listener Feedback from > Dimitri Blyumin* > *Reply-To:* [email protected] > > Name: Dimitri Blyumin > Email: [email protected] > Twitter: > Website: > > Hi Brian, > I'm going through your excellent "Python Testing with pytest" book, and > came across this potential scenario in monkeypatching: if we use setitem > and misspell the key - it will create a new key:value and will leave the > original one as is, no KeyError or warning. > Looking at the docs - there is no option to only accept existing keys. > I think this can be dangerous in some cases when the user expects a value > to be patched, and it is not, e.g. change environment in the config dict > from PRD to DEV. > Did you encounter this and is there a way to ensure that only existing > keys are used in patching? > > > -- > Fireside Labs, LLC (http://fireside.fm/) > > _______________________________________________ > pytest-dev mailing list > [email protected] > https://mail.python.org/mailman/listinfo/pytest-dev >
_______________________________________________ pytest-dev mailing list [email protected] https://mail.python.org/mailman/listinfo/pytest-dev
