Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_repr_short(self):
level = Verbose.level
Verbose.level = 0
item_repr = repr(self.lowest)
Verbose.level = level
assert item_repr == ''
def test_repr_long(self):
level = Verbose.level
Verbose.level = 1
item_repr = repr(self.lowest)
Verbose.level = level
assert item_repr == ""
def _from_tree_type_changes(self, tree):
if 'type_changes' in tree:
for change in tree['type_changes']:
remap_dict = RemapDict({
'old_type': type(change.t1),
'new_type': type(change.t2)
})
self['type_changes'][change.path(
force=FORCE_DEFAULT)] = remap_dict
if Verbose.level:
remap_dict.update(old_value=change.t1, new_value=change.t2)
self.ignore_string_type_changes = ignore_string_type_changes
self.ignore_numeric_type_changes = ignore_numeric_type_changes
self.ignore_type_subclasses = ignore_type_subclasses
self.type_check_func = type_is_subclass_of_type_group if ignore_type_subclasses else type_in_type_group
self.ignore_string_case = ignore_string_case
self.number_to_string = number_to_string_func or number_to_string
self.ignore_nan_inequality = ignore_nan_inequality
self.hashes = {}
self.hasher = hasher
self.significant_digits = self.get_significant_digits(significant_digits, ignore_numeric_type_changes)
self.number_format_notation = number_format_notation
self.tree = TreeResult()
Verbose.level = verbose_level
root = DiffLevel(t1, t2)
self.__diff(root, parents_ids=frozenset({id(t1)}))
self.tree.cleanup()
self.view = view
view_results = self._get_view_results(view)
self.update(view_results)
exclude_types=set(),
verbose_level=1,
view='text',
rootstr='root'):
self.view = view
"""
Specifies the default view. Available views are 'text' and 'tree'.
"""
self.rootstr=rootstr
"""
A name or pythonic path for the root object. Any generated path strings
will start in this.
"""
Verbose.level = verbose_level
if significant_digits is not None and significant_digits < 0:
raise ValueError(
"significant_digits must be None or a non-negative integer")
self.significant_digits = significant_digits
self.__initialize_exclude(exclude_paths, exclude_types)
def _from_tree_type_changes(self, tree):
if 'type_changes' in tree:
for change in tree['type_changes']:
remap_dict = RemapDict({
'old_type': type(change.t1),
'new_type': type(change.t2)
})
self['type_changes'][change.path(
force=FORCE_DEFAULT)] = remap_dict
if Verbose.level:
remap_dict.update(old_value=change.t1, new_value=change.t2)
def __set_or_dict(self):
return {} if Verbose.level >= 2 else set()
def __set_or_dict(self):
return {} if Verbose.level >= 2 else set()