Skip to content

Commit

Permalink
Prepare for release v0.23.0 (#559)
Browse files Browse the repository at this point in the history
- Improve test that raises an exception
- Fix and add missing release notes
  • Loading branch information
llucax authored Aug 3, 2023
2 parents 3e53f01 + b1a4c79 commit 58ca166
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
17 changes: 8 additions & 9 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,31 @@

## Summary

<!-- Here goes a general summary of what this release is about -->
This release ships many small improvements and bug fixes to `Quantity`s. It also depends on [channels](https://github.com/frequenz-floss/frequenz-channels-python/) v0.16.0, so users must update the dependency too.

## Upgrading

<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->

- `Channels` has been upgraded to version 0.16.0, for information on how to upgrade visit https://github.com/frequenz-floss/frequenz-channels-python/releases/tag/v0.16.0
- `Channels` has been upgraded to version 0.16.0, for information on how to upgrade please read the [channels v0.16.0 release notes](visit https://github.com/frequenz-floss/frequenz-channels-python/releases/tag/v0.16.0).
- `Quantity` objects are no longer hashable. This is because of the pitfalls of hashing `float` values.

## New Features

- Quantities

* Add support for the unary negative operator (negation of a quantity).
* Add `abs()`.
* Add a `isclose()` method on quantities to compare them to other values of the same type. Because `Quantity` types are just wrappers around `float`s, direct comparison might not always be desirable.
* Add `zero()` constructor (which returns a singleton) to easily get a zero value.
* Add multiplication by `Percentage` types.
* Add a new quantity class `Frequency` for frequency values.
* Add a new quantity class `Temperature` for temperature values.

- `FormulaEngine` arithmetics now supports scalar multiplication with floats and addition with Quantities
- Add a new method for streaming average temperature values for the battery pool.
- `FormulaEngine` arithmetics now supports scalar multiplication with `float`s and addition with `Quantity`s.
- Add a new `temperature` method for streaming average temperature values for the battery pool.

## Bug Fixes

- Fix formatting issue for `Quantity` objects with zero values.
- Fix formatting isuse for `Quantity` when the base value is float.inf or float.nan.
- Fix formatting issue for `Quantity` when the base value fulfills `math.isinf()` or `math.isnan()`.
- Fix clamping to 100% for the battery pool SoC scaling calculation.

<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
- Fix indexing for empty `MovingWindow`s (now it properly raises an `IndexError`).
8 changes: 2 additions & 6 deletions tests/timeseries/test_moving_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,8 @@ async def test_access_window_by_ts_slice() -> None:
async def test_access_empty_window() -> None:
"""Test accessing an empty window, should throw IndexError"""
window, _ = init_moving_window(timedelta(seconds=5))
try:
window[42]
except IndexError as index_error:
assert str(index_error) == "The buffer is empty."
else:
assert False
with pytest.raises(IndexError, match=r"^The buffer is empty\.$"):
_ = window[42]


async def test_window_size() -> None:
Expand Down

0 comments on commit 58ca166

Please sign in to comment.