Answer prose round 1: 0 🔴, 12 🟡 (0 misread); keep a {} line as an entry, point handed_on and parked_through at the docstrings that hold their rules, split news_after's two kinds of news, say what each parameter is, reword item 517's way out, and report a .tar left behind as its own failure
This commit is contained in:
@@ -86,7 +86,7 @@ def parse_entry(raw: str | bytes) -> Entry | None:
|
||||
|
||||
def json_objects(raw: bytes) -> list[dict]:
|
||||
"""The lines of a transcript or a stream-json stream that are JSON objects, parsed."""
|
||||
return [found for line in raw.splitlines() if (found := json_object(line))]
|
||||
return [found for line in raw.splitlines() if (found := json_object(line)) is not None]
|
||||
|
||||
|
||||
def entries_of(raw: bytes) -> list[Entry]:
|
||||
|
||||
@@ -100,8 +100,8 @@ class Parse(unittest.TestCase):
|
||||
self.assertIsNone(entries.parse_entry("[1, 2]"))
|
||||
|
||||
def test_a_stream_parses_into_an_entry_per_line_that_is_a_json_object(self):
|
||||
raw = b'{"type": "user", "message": {"content": "do it"}}\nnot json\n\n{"type": "summary"}\n'
|
||||
self.assertEqual(entries.entries_of(raw), [entries.HumanTurn(text="do it"), entries.Entry()])
|
||||
raw = b'{"type": "user", "message": {"content": "do it"}}\nnot json\n\n{"type": "summary"}\n{}\n'
|
||||
self.assertEqual(entries.entries_of(raw), [entries.HumanTurn(text="do it"), entries.Entry(), entries.Entry()])
|
||||
self.assertEqual(entries.entries_of(b""), [])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user