Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve auto-generated title in JSON schemas #772

Merged
merged 2 commits into from Aug 21, 2019
Merged

Improve auto-generated title in JSON schemas #772

merged 2 commits into from Aug 21, 2019

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
Collaborator

samuelcolvin commented Aug 21, 2019

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
9 checks passed
PrettyWood added a commit to ToucanToco/toucan-connectors that referenced this issue Jan 24, 2020
PrettyWood added a commit to ToucanToco/toucan-connectors that referenced this issue Jan 24, 2020
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.

2 participants