Skip to content

Commit

Permalink
Merge pull request #62 from blink1073/more-robust-again
Browse files Browse the repository at this point in the history
Add more robustness
  • Loading branch information
blink1073 authored Dec 2, 2021
2 parents 0d56861 + 7351a4e commit 87bdb59
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions jupyter_kernel_test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,13 @@ def test_clear_output(self):

self.flush_channels()
reply, output_msgs = self.execute_helper(code=self.code_clear_output)

self.assertEqual(reply['content']['status'], 'ok')

self.assertGreaterEqual(len(output_msgs), 1)
self.assertEqual(output_msgs[0]['msg_type'], 'clear_output')

found = False
for msg in output_msgs:
if msg['msg_type'] == 'clear_output':
found = True
else:
continue
assert found, 'clear_output message not found'
4 changes: 2 additions & 2 deletions jupyter_kernel_test/msgspec_v5.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_msg_content_validator(msg_type, version_minor):
"type": "object",
"properties": {
"header": header_part,
"parent_header": header_part,
"parent_header": {"type": "object"},
"metadata": {"type": "object"},
"content": {"type": "object"}, # Checked separately
"buffers": {"type": "array"}
Expand Down Expand Up @@ -117,7 +117,7 @@ def validate_message(msg, msg_type=None, parent_id=None):
raise ValidationError("Unexpected keys in header: {}".format(unx_header))

# Check the parent id
if parent_id and msg['parent_header']['msg_id'] != parent_id:
if 'reply' in msg_type and parent_id and msg['parent_header']['msg_id'] != parent_id:
raise ValidationError("Parent header does not match expected")

if msg_type in reply_msgs_using_status:
Expand Down

0 comments on commit 87bdb59

Please sign in to comment.