Test Notebook

This is a test notebook that is run for each new commit of the scijava-jupyter-kernel. The idea is to test all the important features of the kernel.


In [1]:
// @UIService ui
ui.setHeadless(true)


Out[1]:
No Outputs

In [2]:
println "Basic print"


Basic print
Out[2]:
No Outputs

In [3]:
#!groovy
// @LogService log
log.info("Test the script parameter")


[INFO] Test the script parameter
Out[3]:
No Outputs

The below cells are disabled because Travis fails to run them...


In [7]:
// @NotebookService nb
a_groovy_dict = [a_string: 'Hello', a_number: 87]
nb.display(a_groovy_dict)


Out[7]:
KeyValue
a​_stringHello
a​_number87

In [8]:
#!python
import sys
print("Test python language")
print(sys.version)


Test python language
2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)]
Out[8]:
No Outputs

In [9]:
#!groovy


Out[9]:
No Outputs

In [10]:
println "This is groovy code"


This is groovy code

In [11]:
#!python
print(a_groovy_dict["a_string"])
print(a_groovy_dict["a_number"])

assert(a_groovy_dict["a_string"] == "Hello")
assert(a_groovy_dict["a_number"] == 87)


Hello
87
Out[11]:
No Outputs

In [12]:
#!clojure
{:a 4, :e nil}


Out[12]:
KeyValue
:a4
:e<none>

In [13]:
#!groovy
[a:4, e: null]


Out[13]:
KeyValue
a4
e<none>

In [14]:
#!groovy
[["Salutation":"hello", "Valediction":"goodbye"], ["Salutation":"hi", "Valediction":"bye"], 
 ["Salutation":"hey", "Valediction":null]]


Out[14]:
SalutationValediction
hellogoodbye
hibye
hey<none>