Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

Add comparison operators to Record class#44

Merged
Schamper merged 1 commit intomainfrom
add-eq
Apr 29, 2025
Merged

Add comparison operators to Record class#44
Schamper merged 1 commit intomainfrom
add-eq

Conversation

@Schamper
Copy link
Member

@Schamper Schamper commented Jan 28, 2025

Closes #40

Depends on #36.

@codecov
Copy link

codecov bot commented Jan 28, 2025

Codecov Report

Attention: Patch coverage is 56.41026% with 17 lines in your changes missing coverage. Please review.

Project coverage is 78.53%. Comparing base (e11d651) to head (209a282).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dissect/esedb/record.py 56.41% 17 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #44      +/-   ##
==========================================
- Coverage   78.84%   78.53%   -0.32%     
==========================================
  Files          16       16              
  Lines        1418     1444      +26     
==========================================
+ Hits         1118     1134      +16     
- Misses        300      310      +10     
Flag Coverage Δ
unittests 78.53% <56.41%> (-0.32%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comparison operators to the Record class and includes related test cases while refactoring several components such as cursor iteration and long value lookup using a new BTree implementation. Key changes include:

  • Introducing rich comparison methods (eq, lt, etc.) in Record.
  • Adding tests for Record comparisons, table index searches, and cursor navigation.
  • Refactoring long value retrieval in Table and streamlining repr methods across classes.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_table.py Added tests for the new find_index functionality
tests/test_record.py Added tests for Record comparison operators
tests/test_index.py Updated tests for index search behavior including binary values handling
tests/test_cursor.py Added tests for new cursor methods using BTree
dissect/esedb/tools/sru.py Updated repr formatting for Entry
dissect/esedb/table.py Added primary_index property, cursor method, and find_index improvements
dissect/esedb/record.py Added comparison operators and updated _parse_multivalue return type to list[bytes] with new error handling
dissect/esedb/page.py Modified Tag repr formatting
dissect/esedb/index.py Refactored index flag handling and repr improvements
dissect/esedb/cursor.py Refactored cursor implementation to work with BTree
dissect/esedb/c_esedb.py Added new flag definitions
dissect/esedb/btree.py New BTree helper class for B+Tree navigation
Comments suppressed due to low confidence (2)

tests/test_index.py:86

  • The test for 'IxLongBinary' now uses 1000 repetitions of 'a' instead of the previous 1024. Please verify that this change in expected binary length is intentional.
record = table.indexes[14].search(LongBinary=b"test long binary data " + (b"a" * 1000))

dissect/esedb/record.py:324

  • The _parse_multivalue function now raises a ValueError for unknown tag field flags. Confirm that raising an exception here is the desired behavior for handling unrecognized flags.
raise ValueError(f"Unknown flags for tag field: {tag_field}")

Horofic
Horofic previously approved these changes Apr 28, 2025
Copy link
Member

@Horofic Horofic left a comment

Choose a reason for hiding this comment

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

I have only reviewed the changes in record.py here. Gross of the review is done in #36

@Schamper Schamper force-pushed the improve-index-support branch from 4d1b6cb to d295381 Compare April 28, 2025 14:34
@Schamper Schamper force-pushed the add-eq branch 3 times, most recently from acc6656 to 43113b4 Compare April 28, 2025 14:46
@Schamper Schamper force-pushed the improve-index-support branch 2 times, most recently from 27390c5 to d51d52c Compare April 29, 2025 08:51
Base automatically changed from improve-index-support to main April 29, 2025 10:02
@Schamper Schamper dismissed Horofic’s stale review April 29, 2025 10:02

The base branch was changed.

@Schamper Schamper merged commit ca05543 into main Apr 29, 2025
22 of 24 checks passed
@Schamper Schamper deleted the add-eq branch April 29, 2025 10:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add __eq__ to Record class

3 participants