##// END OF EJS Templates
Adds configuration options to use Google Drive content manager...
Adds configuration options to use Google Drive content manager Adds the key contentmanager_js_source to webapp_settings that allows for specifying the content manager JavaScript source file. Also adds a NotebookManager subclass, ClientSideNotebookManager, which does minimal logic. This class is used when the JavaScript content manager doesn't use the Python notebook manager, but rather implements that logic client side, as is the case for the Google Drive based content manager. A sample command line that uses the Google Drive content manager, and the ClientSideNotebookManager, is ipython notebook --NotebookApp.webapp_settings="{'contentmanager_js_source': 'base/js/drive_contentmanager'}" --NotebookApp.notebook_manager_class="IPython.html.services.notebooks.clientsidenbmanager.ClientSideNotebookManager"

File last commit:

r18603:cd1bfb05
r18639:28c27a69
Show More
test_validator.py
58 lines | 1.9 KiB | text/x-python | PythonLexer
"""Test nbformat.validator"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os
from .base import TestsBase
from jsonschema import ValidationError
from IPython.nbformat import read
from ..validator import isvalid, validate
class TestValidator(TestsBase):
def test_nb2(self):
"""Test that a v2 notebook converted to current passes validation"""
with self.fopen(u'test2.ipynb', u'r') as f:
nb = read(f, as_version=4)
validate(nb)
self.assertEqual(isvalid(nb), True)
def test_nb3(self):
"""Test that a v3 notebook passes validation"""
with self.fopen(u'test3.ipynb', u'r') as f:
nb = read(f, as_version=4)
validate(nb)
self.assertEqual(isvalid(nb), True)
def test_nb4(self):
"""Test that a v4 notebook passes validation"""
with self.fopen(u'test4.ipynb', u'r') as f:
nb = read(f, as_version=4)
validate(nb)
self.assertEqual(isvalid(nb), True)
def test_invalid(self):
"""Test than an invalid notebook does not pass validation"""
# this notebook has a few different errors:
# - one cell is missing its source
# - invalid cell type
# - invalid output_type
with self.fopen(u'invalid.ipynb', u'r') as f:
nb = read(f, as_version=4)
with self.assertRaises(ValidationError):
validate(nb)
self.assertEqual(isvalid(nb), False)
def test_future(self):
"""Test than a notebook from the future with extra keys passes validation"""
with self.fopen(u'test4plus.ipynb', u'r') as f:
nb = read(f, as_version=4)
with self.assertRaises(ValidationError):
validate(nb, version=4)
self.assertEqual(isvalid(nb, version=4), False)
self.assertEqual(isvalid(nb), True)