Skip to content

Commit aee1cad

Browse files
committed
Fix kernel_test lint issues
1 parent 922e21e commit aee1cad

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

kernel_test.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ const (
1818
success = "\u2713"
1919
)
2020

21-
const sessionID = "ba65a05c-106a-4799-9a94-7f5631bbe216"
21+
const (
22+
connectionFile = "fixtures/connection_file.json"
23+
sessionID = "ba65a05c-106a-4799-9a94-7f5631bbe216"
24+
)
2225

2326
var (
2427
connectionKey string
@@ -37,8 +40,6 @@ func TestMain(m *testing.M) {
3740
// runTest initializes the environment for the tests and allows for
3841
// the proper exit if the test fails or succeeds.
3942
func runTest(m *testing.M) int {
40-
const connectionFile = "fixtures/connection_file.json"
41-
4243
// Parse the connection info.
4344
var connInfo ConnectionInfo
4445

@@ -140,7 +141,7 @@ func testEvaluate(t *testing.T, codeIn string) string {
140141

141142
assertMsgTypeEquals(t, reply, "execute_reply")
142143

143-
content = getMsgContentAsJsonObject(t, reply)
144+
content = getMsgContentAsJSONObject(t, reply)
144145
status := getString(t, "content", content, "status")
145146

146147
if status != "ok" {
@@ -149,9 +150,9 @@ func testEvaluate(t *testing.T, codeIn string) string {
149150

150151
for _, pubMsg := range pub {
151152
if pubMsg.Header.MsgType == "execute_result" {
152-
content = getMsgContentAsJsonObject(t, pubMsg)
153+
content = getMsgContentAsJSONObject(t, pubMsg)
153154

154-
bundledMIMEData := getJsonObject(t, "content", content, "data")
155+
bundledMIMEData := getJSONObject(t, "content", content, "data")
155156
textRep := getString(t, "content[\"data\"]", bundledMIMEData, "text/plain")
156157

157158
return textRep
@@ -190,7 +191,7 @@ func TestPanicGeneratesError(t *testing.T) {
190191

191192
assertMsgTypeEquals(t, reply, "execute_reply")
192193

193-
content = getMsgContentAsJsonObject(t, reply)
194+
content = getMsgContentAsJSONObject(t, reply)
194195
status := getString(t, "content", content, "status")
195196

196197
if status != "error" {
@@ -355,7 +356,7 @@ func (client *testJupyterClient) performJupyterRequest(t *testing.T, request Com
355356
subMsg := client.recvIOSub(t, 1*time.Second)
356357
assertMsgTypeEquals(t, subMsg, "status")
357358

358-
subData := getMsgContentAsJsonObject(t, subMsg)
359+
subData := getMsgContentAsJSONObject(t, subMsg)
359360
execState := getString(t, "content", subData, "execution_state")
360361

361362
if execState != kernelBusy {
@@ -368,7 +369,7 @@ func (client *testJupyterClient) performJupyterRequest(t *testing.T, request Com
368369

369370
// If the message is a 'status' message, ensure it is an 'idle' status.
370371
if subMsg.Header.MsgType == "status" {
371-
subData = getMsgContentAsJsonObject(t, subMsg)
372+
subData = getMsgContentAsJSONObject(t, subMsg)
372373
execState = getString(t, "content", subData, "execution_state")
373374

374375
if execState != kernelIdle {
@@ -396,9 +397,9 @@ func assertMsgTypeEquals(t *testing.T, msg ComposedMsg, expectedType string) {
396397
}
397398
}
398399

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
400401
// 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{} {
402403
t.Helper()
403404

404405
content, ok := msg.Content.(map[string]interface{})
@@ -428,10 +429,10 @@ func getString(t *testing.T, jsonObjectName string, content map[string]interface
428429
return value
429430
}
430431

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.
432433
// If the key does not exist in the content map or the value is not a map[string]interface{} this will fail the test.
433434
// 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{} {
435436
t.Helper()
436437

437438
raw, ok := content[key]

0 commit comments

Comments
 (0)