Skip to content

Commit 1025ccd

Browse files
committed
Add buffering receivers for display data
1 parent a80ab84 commit 1025ccd

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

crates/ark_test/src/dummy_frontend.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,32 @@ impl DummyArkFrontend {
720720
}
721721
}
722722

723+
/// Receive from IOPub and assert DisplayData message, returning the
724+
/// display_id from the transient field.
725+
/// Automatically skips any Stream messages.
726+
#[track_caller]
727+
pub fn recv_iopub_display_data_id(&self) -> String {
728+
let msg = self.recv_iopub_next();
729+
match msg {
730+
Message::DisplayData(data) => data.content.transient["display_id"]
731+
.as_str()
732+
.expect("display_id should be a string")
733+
.to_string(),
734+
other => panic!("Expected DisplayData, got {:?}", other),
735+
}
736+
}
737+
738+
/// Receive from IOPub and assert UpdateDisplayData message.
739+
/// Automatically skips any Stream messages.
740+
#[track_caller]
741+
pub fn recv_iopub_update_display_data(&self) {
742+
let msg = self.recv_iopub_next();
743+
match msg {
744+
Message::UpdateDisplayData(_) => {},
745+
other => panic!("Expected UpdateDisplayData, got {:?}", other),
746+
}
747+
}
748+
723749
/// Receive from IOPub and assert CommMsg message.
724750
/// Automatically skips any Stream messages.
725751
#[track_caller]

0 commit comments

Comments
 (0)