Skip to content

Commit

Permalink
Release 0.10.4
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsil committed Jul 22, 2024
1 parent 387b83a commit 1338450
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/en/docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release Notes

## 0.10.4

### Fix

- Native `decimal.Decimal` internal convertion to `bson.decimal128.Decimal128` to updates.

## 0.10.3

### Fix
Expand Down
2 changes: 1 addition & 1 deletion mongoz/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.10.3"
__version__ = "0.10.4"

from .conf import settings
from .conf.global_settings import MongozSettings
Expand Down
14 changes: 14 additions & 0 deletions tests/models/manager/test_decimal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from decimal import Decimal
from typing import AsyncGenerator

import bson
import pydantic
import pytest
from bson import Decimal128
Expand Down Expand Up @@ -43,6 +44,19 @@ async def test_decimal_128_two() -> None:
assert float(str(arch.price)) == 22.246


async def test_decimal_128_create_many() -> None:
archives = []
archive_names = ("The Dark Knight", "The Dark Knight Rises", "The Godfather")
for movie_name in archive_names:
archives.append(Archive(name=movie_name, price=Decimal("22.246")))

archives_db = await Archive.objects.create_many(archives)
for archive, archive_db in zip(archives, archives_db):
assert archive.name == archive_db.name
assert archive.price == archive_db.price
assert isinstance(archive.id, bson.ObjectId)


async def test_decimal_on_update() -> None:
await Archive.objects.create(name="Batman", price="22.246")

Expand Down

0 comments on commit 1338450

Please sign in to comment.