Esempio n. 1
0
 def test_worksheet(self):
     cells = [new_code_cell(), new_text_cell("html")]
     ws = new_worksheet(cells=cells, name="foo")
     self.assertEqual(ws.cells, cells)
     self.assertEqual(ws.name, "foo")
Esempio n. 2
0
 def test_markdown_cell(self):
     tc = new_text_cell("markdown", "hi", "hi")
     self.assertEqual(tc.source, "hi")
     self.assertEqual(tc.rendered, "hi")
Esempio n. 3
0
 def test_empty_markdown_cell(self):
     tc = new_text_cell("markdown")
     self.assertEqual(tc.cell_type, "markdown")
     self.assertEqual("source" not in tc, True)
     self.assertEqual("rendered" not in tc, True)
Esempio n. 4
0
 def test_html_cell(self):
     tc = new_text_cell("html", "hi", "hi")
     self.assertEqual(tc.source, "hi")
     self.assertEqual(tc.rendered, "hi")
Esempio n. 5
0
 def test_empty_html_cell(self):
     tc = new_text_cell("html")
     self.assertEqual(tc.cell_type, "html")
     self.assertEqual("source" not in tc, True)
     self.assertEqual("rendered" not in tc, True)
Esempio n. 6
0
    new_metadata,
    new_notebook,
    new_output,
    new_text_cell,
    new_worksheet,
)

# some random base64-encoded *bytes*
png = encodebytes(os.urandom(5))
jpeg = encodebytes(os.urandom(6))

ws = new_worksheet(name="worksheet1")

ws.cells.append(
    new_text_cell("html",
                  source="Some NumPy Examples",
                  rendered="Some NumPy Examples"))

ws.cells.append(
    new_code_cell(input="import numpy", prompt_number=1, collapsed=False))

ws.cells.append(
    new_text_cell("markdown",
                  source="A random array",
                  rendered="A random array"))

ws.cells.append(
    new_code_cell(input="a = numpy.random.rand(100)",
                  prompt_number=2,
                  collapsed=True))