Skip to content

Fix bug with Any validator and REMOVE_EXTRA#524

Merged
alecthomas merged 7 commits intoalecthomas:masterfrom
zxdavb:fix_remove_extra
Apr 30, 2025
Merged

Fix bug with Any validator and REMOVE_EXTRA#524
alecthomas merged 7 commits intoalecthomas:masterfrom
zxdavb:fix_remove_extra

Conversation

@zxdavb
Copy link
Copy Markdown
Contributor

@zxdavb zxdavb commented Aug 17, 2024

I refer to the bug fixed by PR #522.

I am getting a similar issue, and I note that this test would fail with 0.15.2 (but not 0.13.1):

def test_key4():
    schema = Schema(
        {
            Any("name", "area"): str,
            "domain": str,
        },
        extra=REMOVE_EXTRA,  # instead of ALLOW_EXTRA
    )
    schema(
        {
            "name": "one",
            "domain": "two",
            "additional_key": "extra",
        }
    )

This PR offers a fix for the above, and extends the tests to all 4 possible variants of extra=.

Regarding the impact of this PR upon the goals of PR #479 - I note that test_key1 and test_key2 continue to pass.

@zxdavb zxdavb changed the title WIP: Fix bug with REMOVE_EXTRA and Any validator Fix bug with REMOVE_EXTRA and Any validator Aug 17, 2024
@zxdavb zxdavb changed the title Fix bug with REMOVE_EXTRA and Any validator Fix bug with Any validator and REMOVE_EXTRA Aug 21, 2024
@RazerM
Copy link
Copy Markdown

RazerM commented Apr 30, 2025

I was about to checkout the repo and fix this, good to see this PR already exists. I hope we can get it merged

@alecthomas alecthomas merged commit 4a9c8f8 into alecthomas:master Apr 30, 2025
@alecthomas
Copy link
Copy Markdown
Owner

Thanks, and sorry about the delay.

@RazerM
Copy link
Copy Markdown

RazerM commented Apr 30, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants