##// END OF EJS Templates
Fixing HTML cell syntax highlighting.
Fixing HTML cell syntax highlighting.

File last commit:

r4498:b0e516c2
r4505:3896ff19
Show More
test_nbbase.py
66 lines | 2.1 KiB | text/x-python | PythonLexer
Brian E. Granger
Initial draft of more formal notebook format....
r4401 from unittest import TestCase
Brian E. Granger
Full versioning added to nbformat.
r4406 from ..nbbase import (
Brian E. Granger
Initial draft of more formal notebook format....
r4401 NotebookNode,
Brian E. Granger
Starting to rename text cell to html cell.
r4498 new_code_cell, new_html_cell, new_worksheet, new_notebook, new_output
Brian E. Granger
Initial draft of more formal notebook format....
r4401 )
class TestCell(TestCase):
def test_empty_code_cell(self):
cc = new_code_cell()
self.assertEquals(cc.cell_type,'code')
self.assertEquals('input' not in cc, True)
self.assertEquals('prompt_number' not in cc, True)
Brian E. Granger
Updates to basic notebook format....
r4402 self.assertEquals(cc.outputs, [])
Brian E. Granger
Initial draft of more formal notebook format....
r4401
def test_code_cell(self):
Brian E. Granger
Updates to basic notebook format....
r4402 cc = new_code_cell(input='a=10', prompt_number=0)
Brian E. Granger
Starting to rename text cell to html cell.
r4498 cc.outputs = [new_output(output_type='pyout',
output_svg='foo',output_text='10',prompt_number=0)]
Brian E. Granger
Initial draft of more formal notebook format....
r4401 self.assertEquals(cc.input, u'a=10')
self.assertEquals(cc.prompt_number, 0)
Brian E. Granger
Updates to basic notebook format....
r4402 self.assertEquals(cc.language, u'python')
self.assertEquals(cc.outputs[0].svg, u'foo')
self.assertEquals(cc.outputs[0].text, u'10')
Brian E. Granger
Starting to rename text cell to html cell.
r4498 self.assertEquals(cc.outputs[0].prompt_number, 0)
Brian E. Granger
Initial draft of more formal notebook format....
r4401
Brian E. Granger
Starting to rename text cell to html cell.
r4498 def test_empty_html_cell(self):
tc = new_html_cell()
self.assertEquals(tc.cell_type, 'html')
self.assertEquals('source' not in tc, True)
Brian E. Granger
Initial draft of more formal notebook format....
r4401
Brian E. Granger
Starting to rename text cell to html cell.
r4498 def test_html_cell(self):
tc = new_html_cell('hi')
self.assertEquals(tc.source, u'hi')
Brian E. Granger
Initial draft of more formal notebook format....
r4401
class TestWorksheet(TestCase):
def test_empty_worksheet(self):
ws = new_worksheet()
self.assertEquals(ws.cells,[])
self.assertEquals('name' not in ws, True)
def test_worksheet(self):
Brian E. Granger
Starting to rename text cell to html cell.
r4498 cells = [new_code_cell(), new_html_cell()]
Brian E. Granger
Initial draft of more formal notebook format....
r4401 ws = new_worksheet(cells=cells,name='foo')
self.assertEquals(ws.cells,cells)
self.assertEquals(ws.name,u'foo')
class TestNotebook(TestCase):
def test_empty_notebook(self):
nb = new_notebook()
self.assertEquals('id' in nb, True)
self.assertEquals(nb.worksheets, [])
self.assertEquals('name' not in nb, True)
Brian E. Granger
Full versioning added to nbformat.
r4406 self.assertEquals(nb.nbformat,2)
Brian E. Granger
Initial draft of more formal notebook format....
r4401
Brian E. Granger
Full versioning added to nbformat.
r4406 def test_notebook(self):
Brian E. Granger
Initial draft of more formal notebook format....
r4401 worksheets = [new_worksheet(),new_worksheet()]
nb = new_notebook(name='foo',worksheets=worksheets)
self.assertEquals(nb.name,u'foo')
self.assertEquals(nb.worksheets,worksheets)
Brian E. Granger
Full versioning added to nbformat.
r4406 self.assertEquals(nb.nbformat,2)
Brian E. Granger
Initial draft of more formal notebook format....
r4401