11 Commits

Author SHA1 Message Date
Samuel Colvin a57346ac49 Move to ruff for linting (#4709)
* WIP to move to ruff for linting

* add extend-select, fix string
2022-11-03 13:45:34 +00:00
Samuel Colvin 594effa279 Switching to pydantic_core (#4516)
* working on core schema generation

* adapting main.py

* getting tests to run

* fix tests

* disable pyright, fix mypy

* moving to class-based model generation

* working on validators

* change how models are created

* start fixing test_main.py

* fixing mypy

* SelfType

* recursive models working, more tests fixed

* fix tests on <3.10

* get docs build to pass

* starting to cleanup types.py

* starting works on custom types

* working on using annotated-types

* using annoated types for constraints

* lots of cleanup, fixing network tests

* network tests passing 🎉

* working on types

* working on types and cleanup

* fixing UUID type, restructing again

* more types and newer pydantic-core

* working on Iterable

* more test_types tests

* support newer pydantic-core, fixing more test_types.py

* working through more test_types.py

* test_types.py at last passing locally 🎉

* fixing more tests in test_types.py

* fix datetime_parse tests and linting

* get tests running again, rename to test_datetime.py

* renaming internal modules

* working through mypy errors

* fixing mypy

* refactoring _generate_schema.py

* test_main.py passing

* uprev deps

* fix conftest and linting?

* importing Annotated

* ltining

* import Annotated from typing_extensions

* fixing 3.7 compatibility

* fixing tests on 3.9

* fix linting

* fixing SecretField and 3.9 tests

* customising get_type_hints

* ignore warnings on 3.11

* spliting repr out of utils

* removing unused bits of _repr, fix tests for 3.7

* more cleanup, removing many type aliases

* clean up repr

* support namedtuples and typeddicts

* test is_union

* removing errors, uprev pydantic-core

* fix tests on 3.8

* fixing private attributes and model_post_init

* renaming and cleanup

* remove unnecessary PydanticMetadata inheritance

* fixing forward refs and mypy tests

* fix signatures, change how xfail works

* revert mypy tests to 3.7 syntax

* correct model title

* try to fix tests

* fixing ClassVar forward refs

* uprev pydantic-core, new error format

* add "force" argument to model_rebuild

* Apply suggestions from code review

Suggestions from @tiangolo and @hramezani 🙏

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>

* more suggestions from @tiangolo

* extra -> json_schema_extra on Field

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-11-02 12:01:17 +00:00
hottwaj cdd091c8ac Initial implementation of ConstrainedDate, condate (#3740)
* Initial implmenetation of ConstrainedDate, condate, with tests and docs

* Attempt at fixing hypothesis tests for ConstrainedDate.  Suspect still not working

* removed forgotten breakpoint() :(

* suggested changes to pydantic/_hypothesis_plugin.py for condate etc

Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>

* - fixed import for hypothesis tests

* - linting fixes only

* - more fixes for linting

* changes following review by samuelcolvin 2022-08-08.  Will rebase next

* - added changes to changes file

* fixed changes file filename to PR #3740

* additional changes requested by samuelcolvin 2022-08-11: add test for schema_json, add hypothesis test, etc

* make test_json_schema compare to a dictionary rather than json string

* added test_date_constrained_types to test_schema

* rewrite tests

Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2022-08-12 14:37:41 +00:00
SergioSim c356011892 Fix Json strategy serialization failure (#4005)
When generating a pydantic model having nested Json fields with
hypothesis, a JSON serialization exception was raised.
2022-08-08 15:45:21 +01:00
Samuel Colvin 9baec86270 try speeding up ci using caching and rearranging jobs (#3974)
* try speeding up ci using caching and rearranging jobs

* fix job references

* cache lint and docs install

* tweak caching

* tweak caching to avoid conflicts

* correct use of runner.os

* bump

* stop skipping steps depending on cache

* prevent hypothesis flakeyness

* try skipping install steps again

* remove skipping install :-(
2022-05-14 15:32:53 +01:00
Christopher Evans 9cc6d44682 Allow for generation of a constrained decimal with decimal_places argument for hypothesis plugin (#2524)
* Add functionality to create a constrained decimal strategy when decimal_place argument is provided

* adding readme

* edit readme

* adding back confloattmul test

* Update changes/2524-cwe5590.md

Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>

Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
2021-05-09 11:57:14 +01:00
Tobi Lipede 429b439830 Allow for generation of a constrained float with multiple_of argument for hypothesis plugin (#2442)
* added method to generate a constrained float with multiple_of argument

* removed HealthCheck.filter_too_much

* Added change file

* fixes for case when min/max aren't provided; adding an extra test for float gt/lt with multiple of
2021-03-02 18:56:45 +00:00
Eric Jolibois 7cc8d254e9 disable hypothesis health check to avoid false negative (#2389) 2021-02-23 00:44:28 +01:00
Zac Hatfield-Dodds 5b147065a3 build(deps): bump hypothesis from 5.44.0 to 6.3.0 (#2388)
* build(deps): bump hypothesis from 5.44.0 to 6.3.0

Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 5.44.0 to 6.3.0.
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-5.44.0...hypothesis-python-6.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Tweak Hypothesis / Json

Fixing a tricky interaction around priority with subclassing and metaclasses.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-22 15:39:45 +00:00
Samuel Colvin 1ee9737cf5 make hypothesis optional for testing (#2343)
* make hypothesis optional for testing

* fix coveragin in "_hypothesis_plugin.py"

* uncomment ci checks
2021-02-12 10:46:34 +00:00
Zac Hatfield-Dodds 771b0d3d92 Add a Hypothesis plugin (#2097)
* Configure Hypothesis

* Hypothesis plugin docs

* Add Hypothesis plugin

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2021-02-11 12:33:11 +00:00