Skip to content

Commit

Permalink
NBFormatTest is now a mixin, rather than a base class
Browse files Browse the repository at this point in the history
  • Loading branch information
minrk committed Apr 14, 2012
1 parent 7c795e3 commit e3e95c9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 3 additions & 4 deletions IPython/nbformat/v3/tests/formattest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

pjoin = os.path.join

from unittest import TestCase

from ..nbbase import (
NotebookNode,
new_code_cell, new_text_cell, new_worksheet, new_notebook
Expand All @@ -20,7 +18,8 @@
def open_utf8(fname, mode):
return io.open(fname, mode=mode, encoding='utf-8')

class NBFormatTestCase(TestCase):
class NBFormatTest:
"""Mixin for writing notebook format tests"""

# override with appropriate values in subclasses
nb0_ref = None
Expand Down Expand Up @@ -61,4 +60,4 @@ def test_read_file(self):
nb = self.mod.read(f)



2 changes: 1 addition & 1 deletion IPython/nbformat/v3/tests/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .nbexamples import nb0


class TestJSON(formattest.NBFormatTestCase):
class TestJSON(formattest.NBFormatTest, TestCase):

nb0_ref = None
ext = 'ipynb'
Expand Down
5 changes: 4 additions & 1 deletion IPython/nbformat/v3/tests/test_nbpy.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# -*- coding: utf8 -*-

from unittest import TestCase

from . import formattest

from .. import nbpy
from .nbexamples import nb0, nb0_py


class TestPy(formattest.NBFormatTestCase):
class TestPy(formattest.NBFormatTest, TestCase):

nb0_ref = nb0_py
ext = 'py'
Expand Down

0 comments on commit e3e95c9

Please sign in to comment.