Skip to content

Print detailed database difference report in tests for easier debugging#770

Merged
zariiii9003 merged 2 commits intocantools:masterfrom
zariiii9003:improve-diff
Dec 18, 2025
Merged

Print detailed database difference report in tests for easier debugging#770
zariiii9003 merged 2 commits intocantools:masterfrom
zariiii9003:improve-diff

Conversation

@zariiii9003
Copy link
Collaborator

I added a new test with some # TODO comments, some of which i will address in a follow-up PR.

@zariiii9003 zariiii9003 requested a review from andlaus December 17, 2025 17:08
@coveralls
Copy link

coveralls commented Dec 17, 2025

Pull Request Test Coverage Report for Build 20319516101

Details

  • 59 of 73 (80.82%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.05%) to 93.909%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/cantools/database/can/database.py 59 73 80.82%
Totals Coverage Status
Change from base Build 20247287901: -0.05%
Covered Lines: 7462
Relevant Lines: 7946

💛 - Coveralls

Copy link
Member

@andlaus andlaus left a comment

Choose a reason for hiding this comment

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

LGTM

b_attr = getattr(b, name)
if callable(a_attr) or callable(b_attr):
continue
if type(a_attr) is not type(b_attr):
Copy link
Member

Choose a reason for hiding this comment

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

isn't that already covered by the if statement on line 184?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that can be removed


a_attr = getattr(a, name)
b_attr = getattr(b, name)
if callable(a_attr) or callable(b_attr):
Copy link
Member

@andlaus andlaus Dec 17, 2025

Choose a reason for hiding this comment

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

I suppose that if one of these attributes is callable, but the other is not, a diff should be added.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll move it outside the for loop below the type check. The diff entry shouldn't be necessary then as that case will be caught by the type comparison.

@zariiii9003 zariiii9003 merged commit 1db4bed into cantools:master Dec 18, 2025
19 checks passed
@zariiii9003 zariiii9003 deleted the improve-diff branch December 18, 2025 14:25
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.

3 participants