for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import unittest
import io
from binstar_client.inspect_package.ipynb import IPythonNotebook, inspect_ipynb_package
from binstar_client.utils.test.utils import data_dir
class IPythonNotebookTestCase(unittest.TestCase):
def test_package_name(self):
fileobj = io.StringIO()
self.assertEqual(IPythonNotebook('notebook.ipynb', fileobj).name, 'notebook')
def test_package_name_unicode(self):
self.assertEqual(IPythonNotebook(b'na\xcc\x83o.ipynb', fileobj).name, 'nao')
def test_version(self):
with open(data_dir('notebook.ipynb')) as fileobj:
self.assertIsInstance(IPythonNotebook('notebook.ipynb', fileobj).version, str)
class InspectIPYNBPackageTest(unittest.TestCase):
def test_inspect_ipynb_package(self):
package_data, release_data, file_data = inspect_ipynb_package('notebook.ipynb', fileobj)
self.assertEqual({
'name': 'notebook',
'summary': 'IPython notebook'
}, package_data)
'basename': 'notebook.ipynb',
'attrs': {}
}, file_data)
if __name__ == '__main__':
unittest.main()