GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fixing tests · FOSSAware/deepdiff@21823e1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • deepdiff
    • deephash.py
  • tests
    • test_diff_text.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎deepdiff/deephash.py‎

Copy file name to clipboardExpand all lines: deepdiff/deephash.py
-7Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,6 @@ def _prep_dict(self, obj, parent, parents_ids=EMPTY_FROZENSET, print_as_attribut
232232
type_str = 'dict'
233233
return "%s:{%s}" % (type_str, result)
234234

235-
# def _prep_set(self, obj, parent, parents_ids=EMPTY_FROZENSET):
236-
# import pytest; pytest.set_trace()
237-
# return "set:{}".format(self._prep_iterable(obj=obj, parent=parent, parents_ids=parents_ids))
238-
239235
def _prep_iterable(self, obj, parent, parents_ids=EMPTY_FROZENSET):
240236

241237
result = defaultdict(int)
@@ -318,9 +314,6 @@ def _hash(self, obj, parent, parents_ids=EMPTY_FROZENSET):
318314
elif isinstance(obj, tuple):
319315
result = self._prep_tuple(obj=obj, parent=parent, parents_ids=parents_ids)
320316

321-
# elif isinstance(obj, (set, frozenset)):
322-
# result = self._prep_set(obj=obj, parent=parent, parents_ids=parents_ids)
323-
324317
elif isinstance(obj, Iterable):
325318
result = self._prep_iterable(obj=obj, parent=parent, parents_ids=parents_ids)
326319

Collapse file

‎tests/test_diff_text.py‎

Copy file name to clipboardExpand all lines: tests/test_diff_text.py
+10-18Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,27 +1379,19 @@ def test_negative_significant_digits(self):
13791379
with pytest.raises(ValueError):
13801380
DeepDiff(1, 1, significant_digits=-1)
13811381

1382-
def test_number_to_string_func(self):
1383-
def log_number_to_string(number, *args, **kwargs):
1384-
number = math.log(number)
1382+
@pytest.mark.parametrize("t1, t2, significant_digits, ignore_order", [
1383+
(100000, 100021, 3, False),
1384+
([10, 12, 100000], [50, 63, 100021], 3, False),
1385+
([10, 12, 100000], [50, 63, 100021], 3, True),
1386+
])
1387+
def test_number_to_string_func(self, t1, t2, significant_digits, ignore_order):
1388+
def custom_number_to_string(number, *args, **kwargs):
1389+
number = 100 if number < 100 else number
13851390
return number_to_string(number, *args, **kwargs)
13861391

1387-
ddiff = DeepDiff(100000, 100021, significant_digits=4, number_format_notation="e",
1388-
number_to_string_func=log_number_to_string)
1389-
1390-
assert {} == ddiff
1391-
1392-
t1 = [10, 100000]
1393-
t2 = [11, 100021]
1394-
1395-
ddiff = DeepDiff(t1, t2, significant_digits=4, number_format_notation="e",
1396-
number_to_string_func=log_number_to_string)
1397-
result = {'values_changed': {'root[0]': {'new_value': 11, 'old_value': 10}}}
1398-
1399-
assert result == ddiff
1392+
ddiff = DeepDiff(100000, 100021, significant_digits=3, number_format_notation="e",
1393+
number_to_string_func=custom_number_to_string)
14001394

1401-
ddiff = DeepDiff(t1, t2, significant_digits=4, number_format_notation="e",
1402-
number_to_string_func=log_number_to_string, ignore_order=True)
14031395
assert {} == ddiff
14041396

14051397
def test_ignore_type_in_groups(self):

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.