e4dcfc49aa
Tests / Import Check (Python 3.13) (push) Has been cancelled
Tests / Import Check (Python 3.14) (push) Has been cancelled
Tests / Python Tests (Python 3.11) (push) Has been cancelled
Tests / Python Tests (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.14) (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
Tests / Lint and Format (push) Has been cancelled
Tests / Web Node Tests (push) Has been cancelled
Tests / Import Check (Python 3.11) (push) Has been cancelled
Tests / Import Check (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.13) (push) Has been cancelled
31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
from __future__ import annotations
|
|
|
|
from deeptutor.book.engine import BookEngine
|
|
from deeptutor.book.models import Block, BlockStatus, BlockType, Page, PageStatus
|
|
|
|
|
|
def test_force_compile_reset_preserves_user_notes() -> None:
|
|
generated = Block(
|
|
type=BlockType.CODE,
|
|
status=BlockStatus.READY,
|
|
payload={"code": "print(1)"},
|
|
source_anchors=[],
|
|
metadata={"generation_ms": 10, "transition_in": "bridge"},
|
|
)
|
|
note = Block(
|
|
type=BlockType.USER_NOTE,
|
|
status=BlockStatus.READY,
|
|
payload={"body": "keep me"},
|
|
)
|
|
page = Page(status=PageStatus.READY, error="", blocks=[generated, note])
|
|
|
|
BookEngine._reset_page_for_force_compile(page)
|
|
|
|
assert page.status == PageStatus.PENDING
|
|
assert generated.status == BlockStatus.PENDING
|
|
assert generated.payload == {}
|
|
assert generated.error == ""
|
|
assert generated.metadata == {"transition_in": "bridge"}
|
|
assert note.status == BlockStatus.READY
|
|
assert note.payload == {"body": "keep me"}
|