Skip to content

Commit

Permalink
Merge pull request #97 from JakobGM/thomasaarholt/docstrings
Browse files Browse the repository at this point in the history
Fix docstring tests
  • Loading branch information
thomasaarholt authored Aug 18, 2024
2 parents ec9caf9 + 6dbf12b commit 477a242
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/patito/polars.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,8 +817,8 @@ def iter_models(
... product_id: int = pt.Field(unique=True)
... price: float
...
>>> df = pt.DataFrame({"product_id": [1, 2], "price": [10, 20]})
>>> df.set_model(Product)
>>> df = pt.DataFrame({"product_id": [1, 2], "price": [10., 20.]})
>>> df = df.set_model(Product)
>>> for product in df.iter_models():
... print(product)
...
Expand Down
2 changes: 2 additions & 0 deletions src/patito/pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ def from_row(
>>> df = pl.DataFrame(
... [["1", "product name", "1.22"]],
... schema=["product_id", "name", "price"],
... orient="row",
... )
>>> Product.from_row(df)
Product(product_id=1, name='product name', price=1.22)
Expand Down Expand Up @@ -378,6 +379,7 @@ def _from_polars(
>>> df = pl.DataFrame(
... [["1", "product name", "1.22"]],
... schema=["product_id", "name", "price"],
... orient="row",
... )
>>> Product._from_polars(df)
Product(product_id=1, name='product name', price=1.22)
Expand Down

0 comments on commit 477a242

Please sign in to comment.