MCPcopy
hub / github.com/kovidgoyal/kitty / test_empty_data

Method test_empty_data

kitty_tests/dnd.py:671–686  ·  view source on GitHub ↗

Zero-byte payload is handled gracefully – only end signal is sent.

(self)

Source from the content-addressed store, hash-verified

669 self.ae(last['payload'], b'')
670
671 def test_empty_data(self) -> None:
672 """Zero-byte payload is handled gracefully – only end signal is sent."""
673 with dnd_test_window() as (screen, cap):
674 self._register_for_drops(screen, cap, 'text/plain')
675 dnd_test_set_mouse_pos(cap.window_id, 0, 0, 0, 0)
676 dnd_test_fake_drop_event(cap.window_id, True, ['text/plain'])
677 cap.consume()
678
679 parse_bytes(screen, client_request_data(1))
680 dnd_test_fake_drop_data(cap.window_id, 'text/plain', b'')
681 raw = cap.consume()
682 events = parse_escape_codes(raw)
683 r_events = [e for e in events if e['type'] == 'r']
684 # Only the end signal should be present.
685 self.assertEqual(len(r_events), 1, raw)
686 self.ae(r_events[0]['payload'], b'')
687
688 # ---- remote file/directory transfer tests ----------------
689

Callers

nothing calls this directly

Calls 6

_register_for_dropsMethod · 0.95
dnd_test_windowFunction · 0.85
client_request_dataFunction · 0.85
parse_escape_codesFunction · 0.85
consumeMethod · 0.80
parse_bytesFunction · 0.70

Tested by

no test coverage detected