lexiq-legal / pydantic_schemaorg

Schema.org classes in pydantic
MIT License
56 stars 15 forks source link

Add tests #7

Open samuelcolvin opened 2 years ago

samuelcolvin commented 2 years ago

Hi, this question is quite selfish, I'd like to use this repo among others for smoke testing new pydantic releases, see https://github.com/pydantic/pydantic/discussions/4359. According to this this repo has the most pydantic imports, hence why I came here.

It would be great if we could add tests to this repo, I guess either (or both of):

WDYT?

crbaker89 commented 2 years ago

Hi @samuelcolvin. Great to hear from you, i have been using pydantic in so many projects :+1:

In this repo there is already one test script that creates the extended BaseModel classes for all all schema.org examples located at (https://schema.org/version/latest/schemaorg-all-examples.txt). This script effectively checks if the examples provided by schema.org can be loaded into the Pydantic models. The script can be found here: https://github.com/lexiq-legal/pydantic_schemaorg/blob/main/src/test_classes.py.

All the models in this repo are already automatically build according to the Schema.org model definitions. Please do note that these Schema.org models use mostly primitive types and will not cover all of Pydantic's field types.

TL;DR: With a modifications on the existing code I can produce the tests you describe. Maybe you can provide me with a list of Pydantic features/mechanisms you would like to test first? I would be happy to contribute to Pydantic.

Cheers

samuelcolvin commented 2 years ago

Thanks so much would be great if you could test against pydantic v1.10.0b1, more information at https://github.com/pydantic/pydantic/discussions/4419.

Ice now tested that release against quite a lot of libraries, so I doubt there will be a problem, but still busy to check.

Also as per the linked discussion, I'd like to build up a list of libraries I can easily test future pydantic releases against to avoid breaking changes.

westurner commented 1 year ago

Might I suggest @pytest.mark.parametrize (and pytest-cov) or better?

/cc @danbri @RichardWallis @rvguha