@@ -18,7 +18,10 @@ const (
18
18
success = "\u2713 "
19
19
)
20
20
21
- const sessionID = "ba65a05c-106a-4799-9a94-7f5631bbe216"
21
+ const (
22
+ connectionFile = "fixtures/connection_file.json"
23
+ sessionID = "ba65a05c-106a-4799-9a94-7f5631bbe216"
24
+ )
22
25
23
26
var (
24
27
connectionKey string
@@ -37,8 +40,6 @@ func TestMain(m *testing.M) {
37
40
// runTest initializes the environment for the tests and allows for
38
41
// the proper exit if the test fails or succeeds.
39
42
func runTest (m * testing.M ) int {
40
- const connectionFile = "fixtures/connection_file.json"
41
-
42
43
// Parse the connection info.
43
44
var connInfo ConnectionInfo
44
45
@@ -140,7 +141,7 @@ func testEvaluate(t *testing.T, codeIn string) string {
140
141
141
142
assertMsgTypeEquals (t , reply , "execute_reply" )
142
143
143
- content = getMsgContentAsJsonObject (t , reply )
144
+ content = getMsgContentAsJSONObject (t , reply )
144
145
status := getString (t , "content" , content , "status" )
145
146
146
147
if status != "ok" {
@@ -149,9 +150,9 @@ func testEvaluate(t *testing.T, codeIn string) string {
149
150
150
151
for _ , pubMsg := range pub {
151
152
if pubMsg .Header .MsgType == "execute_result" {
152
- content = getMsgContentAsJsonObject (t , pubMsg )
153
+ content = getMsgContentAsJSONObject (t , pubMsg )
153
154
154
- bundledMIMEData := getJsonObject (t , "content" , content , "data" )
155
+ bundledMIMEData := getJSONObject (t , "content" , content , "data" )
155
156
textRep := getString (t , "content[\" data\" ]" , bundledMIMEData , "text/plain" )
156
157
157
158
return textRep
@@ -190,7 +191,7 @@ func TestPanicGeneratesError(t *testing.T) {
190
191
191
192
assertMsgTypeEquals (t , reply , "execute_reply" )
192
193
193
- content = getMsgContentAsJsonObject (t , reply )
194
+ content = getMsgContentAsJSONObject (t , reply )
194
195
status := getString (t , "content" , content , "status" )
195
196
196
197
if status != "error" {
@@ -355,7 +356,7 @@ func (client *testJupyterClient) performJupyterRequest(t *testing.T, request Com
355
356
subMsg := client .recvIOSub (t , 1 * time .Second )
356
357
assertMsgTypeEquals (t , subMsg , "status" )
357
358
358
- subData := getMsgContentAsJsonObject (t , subMsg )
359
+ subData := getMsgContentAsJSONObject (t , subMsg )
359
360
execState := getString (t , "content" , subData , "execution_state" )
360
361
361
362
if execState != kernelBusy {
@@ -368,7 +369,7 @@ func (client *testJupyterClient) performJupyterRequest(t *testing.T, request Com
368
369
369
370
// If the message is a 'status' message, ensure it is an 'idle' status.
370
371
if subMsg .Header .MsgType == "status" {
371
- subData = getMsgContentAsJsonObject (t , subMsg )
372
+ subData = getMsgContentAsJSONObject (t , subMsg )
372
373
execState = getString (t , "content" , subData , "execution_state" )
373
374
374
375
if execState != kernelIdle {
@@ -396,9 +397,9 @@ func assertMsgTypeEquals(t *testing.T, msg ComposedMsg, expectedType string) {
396
397
}
397
398
}
398
399
399
- // getMsgContentAsJsonObject is a test helper that fails the rest if the message content is not a
400
+ // getMsgContentAsJSONObject is a test helper that fails the rest if the message content is not a
400
401
// map[string]interface{} and returns the content as a map[string]interface{} if it is of the correct type.
401
- func getMsgContentAsJsonObject (t * testing.T , msg ComposedMsg ) map [string ]interface {} {
402
+ func getMsgContentAsJSONObject (t * testing.T , msg ComposedMsg ) map [string ]interface {} {
402
403
t .Helper ()
403
404
404
405
content , ok := msg .Content .(map [string ]interface {})
@@ -428,10 +429,10 @@ func getString(t *testing.T, jsonObjectName string, content map[string]interface
428
429
return value
429
430
}
430
431
431
- // getString is a test helper that retrieves a value as a map[string]interface{} from the content at the given key.
432
+ // getJSONObject is a test helper that retrieves a value as a map[string]interface{} from the content at the given key.
432
433
// If the key does not exist in the content map or the value is not a map[string]interface{} this will fail the test.
433
434
// The jsonObjectName parameter is a string used to name the content for more helpful fail messages.
434
- func getJsonObject (t * testing.T , jsonObjectName string , content map [string ]interface {}, key string ) map [string ]interface {} {
435
+ func getJSONObject (t * testing.T , jsonObjectName string , content map [string ]interface {}, key string ) map [string ]interface {} {
435
436
t .Helper ()
436
437
437
438
raw , ok := content [key ]
0 commit comments