Skip to content

Conversation

skewty
Copy link
Contributor

@skewty skewty commented Aug 21, 2019

Underscore is converted to space.
Closes #743

NOTE the following unit test is not passing for me:

tests/test_validators.py:641 (test_assert_raises_validation_error)
def test_assert_raises_validation_error():
        class Model(BaseModel):
            a: str
    
            @validator('a')
            def check_a(cls, v):
                assert v == 'a', 'invalid a'
                return v
    
        Model(a='a')
    
        with pytest.raises(ValidationError) as exc_info:
            Model(a='snap')
        injected_by_pytest = "\nassert 'snap' == 'a'\n  - snap\n  + a"
>       assert exc_info.value.errors() == [
            {'loc': ('a',), 'msg': f'invalid a{injected_by_pytest}', 'type': 'assertion_error'}
        ]
E       assert [{'loc': ('a',),\n  'msg': "invalid a\nassert 'snap' == 'a'",\n  'type': 'assertion_error'}] == [{'loc': ('a',),\n  'msg': "invalid a\nassert 'snap' == 'a'\n  - snap\n  + a",\n  'type': 'assertion_error'}]

tests/test_validators.py:656: AssertionError

Underscore is converted to space.
@samuelcolvin
Copy link
Member

Looks good to me, please add a change description.

In general best to keep the checkboxes from the PR template, but doesn't matter this time.

@samuelcolvin samuelcolvin merged commit 5015a7e into pydantic:master Aug 21, 2019
PrettyWood added a commit to ToucanToco/toucan-connectors that referenced this pull request Jan 24, 2020
PrettyWood added a commit to ToucanToco/toucan-connectors that referenced this pull request Jan 24, 2020
alexdrydew pushed a commit to alexdrydew/pydantic that referenced this pull request Dec 23, 2023
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
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.

Improve auto-generated JSON Schema title when none provided
2 participants