Skip to content

Commit 534639b

Browse files
CopilotKentBeck
andcommitted
Fix code formatting and eliminate Rust compiler warnings
Co-authored-by: KentBeck <46154+KentBeck@users.noreply.github.com>
1 parent 90f00c1 commit 534639b

18 files changed

+457
-367
lines changed

python/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Pytest configuration for building the C extension before tests.
33
"""
4+
45
import sys
56
import subprocess
67
from pathlib import Path

python/coverage.xml

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0" ?>
2-
<coverage version="7.8.2" timestamp="1751690296947" lines-valid="524" lines-covered="381" line-rate="0.7271" branches-valid="176" branches-covered="103" branch-rate="0.5852" complexity="0">
3-
<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.8.2 -->
2+
<coverage version="7.10.5" timestamp="1755964741075" lines-valid="524" lines-covered="426" line-rate="0.813" branches-valid="176" branches-covered="122" branch-rate="0.6932" complexity="0">
3+
<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.10.5 -->
44
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
55
<sources>
6-
<source>/Users/kentb/Dropbox/Mac/Documents/augment-projects/BPlusTree3/python/bplustree</source>
6+
<source>/home/runner/work/BPlusTree3/BPlusTree3/python/bplustree</source>
77
</sources>
88
<packages>
9-
<package name="." line-rate="0.7271" branch-rate="0.5852" complexity="0">
9+
<package name="." line-rate="0.813" branch-rate="0.6932" complexity="0">
1010
<classes>
1111
<class name="__init__.py" filename="__init__.py" complexity="0" line-rate="0.1299" branch-rate="0">
1212
<methods/>
@@ -90,7 +90,7 @@
9090
<line number="133" hits="1"/>
9191
</lines>
9292
</class>
93-
<class name="bplus_tree.py" filename="bplus_tree.py" complexity="0" line-rate="0.83" branch-rate="0.6867">
93+
<class name="bplus_tree.py" filename="bplus_tree.py" complexity="0" line-rate="0.9306" branch-rate="0.8133">
9494
<methods/>
9595
<lines>
9696
<line number="8" hits="1"/>
@@ -116,31 +116,31 @@
116116
<line number="76" hits="1"/>
117117
<line number="78" hits="1"/>
118118
<line number="79" hits="1"/>
119-
<line number="94" hits="0"/>
120-
<line number="95" hits="0"/>
121-
<line number="96" hits="0"/>
119+
<line number="94" hits="1"/>
120+
<line number="95" hits="1"/>
121+
<line number="96" hits="1"/>
122122
<line number="98" hits="1"/>
123-
<line number="100" hits="0"/>
124-
<line number="101" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="102,103"/>
123+
<line number="100" hits="1"/>
124+
<line number="101" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="102"/>
125125
<line number="102" hits="0"/>
126-
<line number="103" hits="0"/>
127-
<line number="107" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="exit,108"/>
128-
<line number="108" hits="0"/>
129-
<line number="110" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="107,111"/>
130-
<line number="111" hits="0"/>
131-
<line number="112" hits="0"/>
126+
<line number="103" hits="1"/>
127+
<line number="107" hits="1" branch="true" condition-coverage="100% (2/2)"/>
128+
<line number="108" hits="1"/>
129+
<line number="110" hits="1" branch="true" condition-coverage="100% (2/2)"/>
130+
<line number="111" hits="1"/>
131+
<line number="112" hits="1"/>
132132
<line number="114" hits="1"/>
133-
<line number="121" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="127,131"/>
134-
<line number="127" hits="0"/>
135-
<line number="128" hits="0"/>
136-
<line number="129" hits="0"/>
137-
<line number="131" hits="0"/>
138-
<line number="132" hits="0"/>
133+
<line number="121" hits="1" branch="true" condition-coverage="100% (2/2)"/>
134+
<line number="127" hits="1"/>
135+
<line number="128" hits="1"/>
136+
<line number="129" hits="1"/>
137+
<line number="131" hits="1"/>
138+
<line number="132" hits="1"/>
139139
<line number="134" hits="1"/>
140-
<line number="136" hits="0"/>
141-
<line number="137" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="138,139"/>
142-
<line number="138" hits="0"/>
143-
<line number="139" hits="0"/>
140+
<line number="136" hits="1"/>
141+
<line number="137" hits="1" branch="true" condition-coverage="100% (2/2)"/>
142+
<line number="138" hits="1"/>
143+
<line number="139" hits="1"/>
144144
<line number="141" hits="1"/>
145145
<line number="148" hits="1"/>
146146
<line number="151" hits="1" branch="true" condition-coverage="100% (2/2)"/>
@@ -204,8 +204,8 @@
204204
<line number="272" hits="1"/>
205205
<line number="273" hits="1"/>
206206
<line number="274" hits="1"/>
207-
<line number="275" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="276"/>
208-
<line number="276" hits="0"/>
207+
<line number="275" hits="1" branch="true" condition-coverage="100% (2/2)"/>
208+
<line number="276" hits="1"/>
209209
<line number="279" hits="1" branch="true" condition-coverage="100% (2/2)"/>
210210
<line number="281" hits="1"/>
211211
<line number="286" hits="1" branch="true" condition-coverage="100% (2/2)"/>
@@ -219,36 +219,36 @@
219219
<line number="301" hits="1"/>
220220
<line number="302" hits="1"/>
221221
<line number="305" hits="1"/>
222-
<line number="308" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="315"/>
222+
<line number="308" hits="1" branch="true" condition-coverage="100% (2/2)"/>
223223
<line number="309" hits="1"/>
224224
<line number="310" hits="1" branch="true" condition-coverage="100% (2/2)"/>
225225
<line number="311" hits="1"/>
226226
<line number="312" hits="1"/>
227-
<line number="315" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="316"/>
228-
<line number="316" hits="0"/>
229-
<line number="317" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="318,322"/>
230-
<line number="318" hits="0"/>
231-
<line number="319" hits="0"/>
227+
<line number="315" hits="1" branch="true" condition-coverage="100% (2/2)"/>
228+
<line number="316" hits="1"/>
229+
<line number="317" hits="1" branch="true" condition-coverage="100% (2/2)"/>
230+
<line number="318" hits="1"/>
231+
<line number="319" hits="1"/>
232232
<line number="322" hits="1" branch="true" condition-coverage="100% (2/2)"/>
233233
<line number="323" hits="1"/>
234234
<line number="325" hits="1"/>
235-
<line number="327" hits="0"/>
236-
<line number="328" hits="0"/>
237-
<line number="330" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="332,337"/>
238-
<line number="332" hits="0"/>
239-
<line number="334" hits="0"/>
240-
<line number="337" hits="0"/>
241-
<line number="338" hits="0"/>
242-
<line number="339" hits="0"/>
235+
<line number="327" hits="1"/>
236+
<line number="328" hits="1"/>
237+
<line number="330" hits="1" branch="true" condition-coverage="100% (2/2)"/>
238+
<line number="332" hits="1"/>
239+
<line number="334" hits="1"/>
240+
<line number="337" hits="1"/>
241+
<line number="338" hits="1"/>
242+
<line number="339" hits="1"/>
243243
<line number="341" hits="1"/>
244244
<line number="343" hits="1"/>
245245
<line number="344" hits="1"/>
246-
<line number="346" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="353"/>
246+
<line number="346" hits="1" branch="true" condition-coverage="100% (2/2)"/>
247247
<line number="348" hits="1"/>
248248
<line number="350" hits="1"/>
249-
<line number="353" hits="0"/>
250-
<line number="354" hits="0"/>
251-
<line number="355" hits="0"/>
249+
<line number="353" hits="1"/>
250+
<line number="354" hits="1"/>
251+
<line number="355" hits="1"/>
252252
<line number="357" hits="1"/>
253253
<line number="359" hits="1"/>
254254
<line number="362" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="363"/>
@@ -257,20 +257,20 @@
257257
<line number="367" hits="0"/>
258258
<line number="372" hits="1" branch="true" condition-coverage="100% (2/2)"/>
259259
<line number="374" hits="1"/>
260-
<line number="376" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="391"/>
260+
<line number="376" hits="1" branch="true" condition-coverage="100% (2/2)"/>
261261
<line number="378" hits="1"/>
262262
<line number="379" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="388"/>
263263
<line number="381" hits="1"/>
264264
<line number="383" hits="1"/>
265265
<line number="384" hits="1"/>
266266
<line number="388" hits="0"/>
267-
<line number="391" hits="0"/>
268-
<line number="394" hits="0"/>
269-
<line number="395" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="397,404"/>
270-
<line number="397" hits="0"/>
271-
<line number="398" hits="0"/>
272-
<line number="400" hits="0"/>
273-
<line number="401" hits="0"/>
267+
<line number="391" hits="1"/>
268+
<line number="394" hits="1"/>
269+
<line number="395" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="404"/>
270+
<line number="397" hits="1"/>
271+
<line number="398" hits="1"/>
272+
<line number="400" hits="1"/>
273+
<line number="401" hits="1"/>
274274
<line number="404" hits="0"/>
275275
<line number="406" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="442"/>
276276
<line number="408" hits="1"/>
@@ -326,7 +326,7 @@
326326
<line number="493" hits="1"/>
327327
<line number="494" hits="1"/>
328328
<line number="496" hits="1"/>
329-
<line number="512" hits="0"/>
329+
<line number="512" hits="1"/>
330330
<line number="514" hits="1"/>
331331
<line number="517" hits="1"/>
332332
<line number="518" hits="1"/>

python/setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ def get_long_description():
100100
author="Kent Beck",
101101
author_email="kent@kentbeck.com",
102102
url="https://github.com/KentBeck/BPlusTree3",
103-
project_urls={
104-
"Homepage": "https://github.com/KentBeck/BPlusTree3",
105-
"Documentation": "https://github.com/KentBeck/BPlusTree3/tree/main/python",
106-
"Repository": "https://github.com/KentBeck/BPlusTree3",
103+
project_urls={
104+
"Homepage": "https://github.com/KentBeck/BPlusTree3",
105+
"Documentation": "https://github.com/KentBeck/BPlusTree3/tree/main/python",
106+
"Repository": "https://github.com/KentBeck/BPlusTree3",
107107
"Issues": "https://github.com/KentBeck/BPlusTree3/issues",
108108
"Changelog": "https://github.com/KentBeck/BPlusTree3/blob/main/python/CHANGELOG.md",
109109
},

python/tests/test_c_extension.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
try:
1717
import bplustree_c
18+
1819
HAS_C_EXTENSION = True
1920
except ImportError as e:
2021
pytest.skip(f"C extension not available: {e}", allow_module_level=True)

python/tests/test_c_extension_comprehensive.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
try:
1414
import bplustree_c
15+
1516
HAS_C_EXTENSION = True
1617
except ImportError as e:
1718
pytest.skip(f"C extension not available: {e}", allow_module_level=True)

python/tests/test_dictionary_api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@
1212
try:
1313
# Try to import from installed package first
1414
import bplustree
15+
1516
BPlusTreeMap = bplustree.BPlusTreeMap
1617
except ImportError:
1718
# Fall back to local import if package not installed
1819
import sys
1920
import os
21+
2022
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
2123
import bplustree
24+
2225
BPlusTreeMap = bplustree.BPlusTreeMap
2326

2427

python/tests/test_docstyle.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ def test_pydocstyle_conformance():
1515
stderr=subprocess.STDOUT,
1616
text=True,
1717
)
18-
18+
1919
# For now, just warn about violations instead of failing
2020
if result.returncode != 0:
21-
pytest.skip(f"Docstyle violations found (non-failing for now):\n{result.stdout}")
21+
pytest.skip(
22+
f"Docstyle violations found (non-failing for now):\n{result.stdout}"
23+
)

python/tests/test_iterator_modification_safety.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
try:
1616
import bplustree_c
17+
1718
HAS_C_EXTENSION = True
1819
except ImportError:
1920
HAS_C_EXTENSION = False
@@ -308,7 +309,9 @@ def test_modification_counter_wrapping(self):
308309
next(keys_iter)
309310
tree[i + 10000] = "trigger_invalidation"
310311

311-
with pytest.raises(RuntimeError, match="tree changed size during iteration"):
312+
with pytest.raises(
313+
RuntimeError, match="tree changed size during iteration"
314+
):
312315
next(keys_iter)
313316

314317
# Final iteration should work
@@ -335,4 +338,5 @@ def test_modification_counter_wrapping(self):
335338
except Exception as e:
336339
print(f"❌ Test failed: {e}")
337340
import traceback
341+
338342
traceback.print_exc()

python/tests/test_no_segfaults.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,14 @@ def test_no_segfaults():
261261
print("🎉 NO SEGFAULTS! C extension is memory-safe.")
262262
else:
263263
print("🚨 CRITICAL: Fix all issues before proceeding!")
264-
assert False, f"CRITICAL: {failed} segfault tests failed - must fix immediately!"
265-
264+
assert (
265+
False
266+
), f"CRITICAL: {failed} segfault tests failed - must fix immediately!"
267+
266268
# Explicitly assert success
267-
assert failed == 0, f"CRITICAL: {failed} segfault tests failed - must fix immediately!"
269+
assert (
270+
failed == 0
271+
), f"CRITICAL: {failed} segfault tests failed - must fix immediately!"
268272

269273

270274
if __name__ == "__main__":

python/tests/test_node_split_minimal.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
try:
1414
import bplustree_c
15+
1516
HAS_C_EXTENSION = True
1617
except ImportError as e:
1718
pytest.skip(f"C extension not available: {e}", allow_module_level=True)
@@ -39,7 +40,13 @@ def test_single_node_split_maintains_order():
3940
print(f"Expected: [0, 1, 2, 3, 4]")
4041

4142
# THE CRITICAL TEST: keys must be sorted
42-
assert keys == [0, 1, 2, 3, 4], f"Keys not in sorted order after single node split. Got: {keys}"
43+
assert keys == [
44+
0,
45+
1,
46+
2,
47+
3,
48+
4,
49+
], f"Keys not in sorted order after single node split. Got: {keys}"
4350
print("✅ PASSED: Keys in correct order after split")
4451

4552

0 commit comments

Comments
 (0)