Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# DeepDiff v 4.0.5
# DeepDiff v 4.0.6

<!-- ![Downloads](https://img.shields.io/pypi/dm/deepdiff.svg?style=flat) -->
![Python Versions](https://img.shields.io/pypi/pyversions/deepdiff.svg?style=flat)
Expand Down Expand Up @@ -417,6 +417,8 @@ And then running

# ChangeLog


- v4-0-6: found a tiny bug in Python formatting of numbers in scientific notation. Added a workaround.
- v4-0-5: Fixing number diffing. Adding number_format_notation and number_to_string_func.
- v4-0-4: Adding ignore_string_case and ignore_type_subclasses
- v4-0-3: Adding versionbump tool for release
Expand Down
2 changes: 1 addition & 1 deletion deepdiff/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""This module offers the DeepDiff, DeepSearch, grep and DeepHash classes."""
# flake8: noqa
__version__ = '4.0.5'
__version__ = '4.0.6'
import logging

if __name__ == '__main__':
Expand Down
3 changes: 3 additions & 0 deletions deepdiff/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,7 @@ def number_to_string(number, significant_digits, number_format_notation="f"):
# Special case for 0: "-0.00" should compare equal to "0.00"
if set(result) <= ZERO_DECIMAL_CHARACTERS:
result = "0.00"
# https://bugs.python.org/issue36622
if number_format_notation == 'e' and isinstance(number, float):
result = result.replace('+0', '+')
return result
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
# built documents.
#
# The short X.Y version.
version = '4.0.5'
version = '4.0.6'
# The full version, including alpha/beta/rc tags.
release = '4.0.5'
release = '4.0.6'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
contain the root `toctree` directive.


DeepDiff 4.0.5 documentation!
DeepDiff 4.0.6 documentation!
=============================

**DeepDiff: Deep Difference of dictionaries, iterables, strings and other objects. It will recursively look for all the changes.**
Expand Down Expand Up @@ -281,6 +281,7 @@ Indices and tables
Changelog
=========

- v4-0-6: found a tiny bug in Python formatting of numbers in scientific notation. Added a workaround.
- v4-0-5: Fixing number diffing. Adding number_format_notation and number_to_string_func.
- v4-0-4: Adding ignore_string_case and ignore_type_subclasses
- v4-0-3: Adding versionbump tool for release
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 4.0.5
current_version = 4.0.6
commit = True
tag = True
tag_name = {new_version}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
if os.environ.get('USER', '') == 'vagrant':
del os.link

version = '4.0.5'
version = '4.0.6'


def get_reqs(filename):
Expand Down
16 changes: 9 additions & 7 deletions tests/test_diff_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -1313,14 +1313,16 @@ def test_int_to_unicode(self):
}
assert result == ddiff

@pytest.mark.parametrize("t1, t2, significant_digits, number_format_notation, result", [
(Decimal('2.5'), Decimal('1.5'), 0, "f", {}),
(Decimal('2.5'), Decimal('1.5'), 1, "f", {'values_changed': {'root': {'new_value': Decimal('1.5'), 'old_value': Decimal('2.5')}}}),
(Decimal('2.5'), Decimal(2.5), 3, "f", {}),
(1024, 1022, 2, "e", {}),
@pytest.mark.parametrize("t1, t2, ignore_numeric_type_changes, significant_digits, number_format_notation, result", [
(Decimal('2.5'), Decimal('1.5'), False, 0, "f", {}),
(Decimal('2.5'), Decimal('1.5'), False, 1, "f", {'values_changed': {'root': {'new_value': Decimal('1.5'), 'old_value': Decimal('2.5')}}}),
(Decimal('2.5'), Decimal(2.5), False, 3, "f", {}),
(1024, 1022, False, 2, "e", {}),
({"key": [Decimal('2.0001'), Decimal('20000.0001')]}, {"key": [2.0002, 20000.0002]}, True, 4, "e", {'values_changed': {"root['key'][0]": {'new_value': 2.0002, 'old_value': Decimal('2.0001')}}})
])
def test_significant_digits_and_notation(self, t1, t2, significant_digits, number_format_notation, result):
ddiff = DeepDiff(t1, t2, significant_digits=significant_digits, number_format_notation=number_format_notation)
def test_significant_digits_and_notation(self, t1, t2, ignore_numeric_type_changes, significant_digits, number_format_notation, result):
ddiff = DeepDiff(t1, t2, significant_digits=significant_digits, number_format_notation=number_format_notation,
ignore_numeric_type_changes=ignore_numeric_type_changes)
assert result == ddiff

def test_significant_digits_for_complex_imaginary_part(self):
Expand Down