Ejemplo n.º 1
0
 def open_cell(self, line, execution_count):
     if '<markdowncell>' in line:
         self.current_cell = Cell({
             'cell_type': 'markdown',
             'metadata': {},
             'source': []
         })
     else:
         self.current_cell = Cell({
             'cell_type': 'code',
             'execution_count': execution_count,
             'metadata': {
                 'collapsed': False
             },
             'outputs': []
         })
 def test_cell_object_to_generate_output_method(self):
     cell = Cell({'cell_type': 'code', 'source': ['a', 'b']})
     print cell.generate_field_output()
     self.assertEquals('\n# <codecell>\n\nab\n', cell.generate_field_output())
 def test_cell_object_to_dict_method(self):
     cell = Cell({'cell_type': 'code', 'source': ['a', 'b']})
     self.assertDictEqual(cell.to_dict(), {'cell_type': 'code', 'source': ['a', 'b']})
 def test_cell_object_init_source(self):
     cell = Cell({'cell_type': 'code', 'source': ['a', 'b']})
     self.assertListEqual(cell.source, ['a', 'b'])
 def test_cell_object_to_generate_output_method(self):
     cell = Cell({'cell_type': 'code', 'source': ['a', 'b']})
     print cell.generate_field_output()
     self.assertEquals('\n# <codecell>\n\nab\n',
                       cell.generate_field_output())
 def test_cell_object_to_dict_method(self):
     cell = Cell({'cell_type': 'code', 'source': ['a', 'b']})
     self.assertDictEqual(cell.to_dict(), {
         'cell_type': 'code',
         'source': ['a', 'b']
     })
 def test_cell_object_init_cell_type(self):
     cell = Cell({'cell_type': 'code', 'source': ['a', 'b']})
     self.assertEquals(cell.type, 'code')