testEvaluate evaluates a cell.
(t *testing.T, codeIn string)
| 166 | |
| 167 | // testEvaluate evaluates a cell. |
| 168 | func testEvaluate(t *testing.T, codeIn string) string { |
| 169 | client, closeClient := newTestJupyterClient(t) |
| 170 | defer closeClient() |
| 171 | |
| 172 | content, pub := client.executeCode(t, codeIn) |
| 173 | |
| 174 | status := getString(t, "content", content, "status") |
| 175 | |
| 176 | if status != "ok" { |
| 177 | t.Fatalf("\t%s Execution encountered error [%s]: %s", failure, content["ename"], content["evalue"]) |
| 178 | } |
| 179 | |
| 180 | for _, pubMsg := range pub { |
| 181 | if pubMsg.Header.MsgType == "execute_result" { |
| 182 | content = getMsgContentAsJSONObject(t, pubMsg) |
| 183 | |
| 184 | bundledMIMEData := getJSONObject(t, "content", content, "data") |
| 185 | textRep := getString(t, `content["data"]`, bundledMIMEData, "text/plain") |
| 186 | |
| 187 | return textRep |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | return "" |
| 192 | } |
| 193 | |
| 194 | // TestPanicGeneratesError tests that executing code with an un-recovered panic properly generates both |
| 195 | // an error "execute_reply" and publishes an "error" message. |
no test coverage detected