Skip to content

issue#50: fix partial_diff #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 13, 2023
Merged

issue#50: fix partial_diff #163

merged 2 commits into from
Dec 13, 2023

Conversation

Dan1lD
Copy link
Collaborator

@Dan1lD Dan1lD commented Nov 9, 2023

fix #50

@Dan1lD Dan1lD requested a review from SyrexMinus November 9, 2023 08:27
@Dan1lD Dan1lD changed the title issue#50: fix partiial_diff issue#50: fix partial_diff Nov 10, 2023
if expected != actual and \
not (isinstance(actual, str) and isinstance(expected, str) and re.fullmatch(expected, actual)):
if (not isinstance(actual, type(expected)) or
(isinstance(actual, str) and isinstance(expected, str) and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(isinstance(actual, str) and isinstance(expected, str) and
(isinstance(actual, str) and

Из предыдущего экспрешна следует, что типы совпадают

@@ -20,8 +20,10 @@ def __init__(self):
@classmethod
def partial_diff(cls, expected: Any, actual: Any, path="", dict_check_does_not_expected=False) -> Diff:
diff = cls()
if expected != actual and \
not (isinstance(actual, str) and isinstance(expected, str) and re.fullmatch(expected, actual)):
if (not isinstance(actual, type(expected)) or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (not isinstance(actual, type(expected)) or
if not isinstance(actual, type(expected) or

if (not isinstance(actual, type(expected)) or
(isinstance(actual, str) and isinstance(expected, str) and
expected != actual and not re.fullmatch(expected, actual)) or
expected != actual):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если там была регулярка, это зафейлится

Copy link
Contributor

@SyrexMinus SyrexMinus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

фейл для регулярки

@SyrexMinus SyrexMinus merged commit e23710e into main Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: expected string or bytes-like object in smart_kit/utils/diff.py
2 participants