Skip to content

Commit ba0056c

Browse files
committed
fix: ci windows
1 parent f57dd9d commit ba0056c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

tests/test_security.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -324,20 +324,22 @@ def count_depth(entries, d=0):
324324
return d
325325
return max(count_depth(e.children, d + 1) for e in entries)
326326

327-
depth = count_depth(book.toc)
328-
assert depth <= 101 # 100 max depth + 1 for root level
327+
actual_depth = count_depth(book.toc)
328+
assert actual_depth <= 101 # 100 max depth + 1 for root level
329329

330330
def test_deeply_nested_nav(self):
331-
"""Nav document with 200 levels of nested <ol> should not crash."""
332-
# Build deeply nested nav XHTML
331+
"""Nav document with deep nesting should not crash."""
332+
# 50 levels — exceeds typical books but safe for all OS stack sizes.
333+
# (200 levels overflows Windows' 1MB default stack during XML DOM parsing.)
334+
depth = 50
333335
nav_parts = [
334336
'<?xml version="1.0"?>',
335337
'<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">',
336338
'<body><nav epub:type="toc"><ol>',
337339
]
338-
for i in range(200):
340+
for i in range(depth):
339341
nav_parts.append(f'<li><a href="ch{i}.xhtml">Level {i}</a><ol>')
340-
for _ in range(200):
342+
for _ in range(depth):
341343
nav_parts.append('</ol></li>')
342344
nav_parts.append('</ol></nav></body></html>')
343345
nav_xhtml = "\n".join(nav_parts)
@@ -377,8 +379,8 @@ def count_depth(entries, d=0):
377379
return d
378380
return max(count_depth(e.children, d + 1) for e in entries)
379381

380-
depth = count_depth(book.toc)
381-
assert depth <= 101
382+
actual_depth = count_depth(book.toc)
383+
assert actual_depth <= 101
382384

383385
def test_normal_nesting_works(self):
384386
"""3-level nesting (common in real books) should work fine."""

0 commit comments

Comments
 (0)