> 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 <variedthoug...@gmail.com> wrote: > I think I want to get some extra help on this good question. > - Brian > > - Brian > > Begin forwarded message: > > *From:* Dimitri Blyumin via Fireside <contactf...@fireside.fm> > *Date:* March 20, 2021 at 7:36:58 PM PDT > *To:* br...@pythontesting.net > *Subject:* *[Test & Code : Python Testing] Listener Feedback from > Dimitri Blyumin* > *Reply-To:* dimitri.blyu...@gmail.com > > Name: Dimitri Blyumin > Email: dimitri.blyu...@gmail.com > 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 > pytest-dev@python.org > https://mail.python.org/mailman/listinfo/pytest-dev >
_______________________________________________ pytest-dev mailing list pytest-dev@python.org https://mail.python.org/mailman/listinfo/pytest-dev