##// END OF EJS Templates
NBFormatTest is now a mixin, rather than a base class
MinRK -
Show More
@@ -6,8 +6,6 b' import tempfile'
6
6
7 pjoin = os.path.join
7 pjoin = os.path.join
8
8
9 from unittest import TestCase
10
11 from ..nbbase import (
9 from ..nbbase import (
12 NotebookNode,
10 NotebookNode,
13 new_code_cell, new_text_cell, new_worksheet, new_notebook
11 new_code_cell, new_text_cell, new_worksheet, new_notebook
@@ -20,7 +18,8 b' from .nbexamples import nb0, nb0_py'
20 def open_utf8(fname, mode):
18 def open_utf8(fname, mode):
21 return io.open(fname, mode=mode, encoding='utf-8')
19 return io.open(fname, mode=mode, encoding='utf-8')
22
20
23 class NBFormatTestCase(TestCase):
21 class NBFormatTest:
22 """Mixin for writing notebook format tests"""
24
23
25 # override with appropriate values in subclasses
24 # override with appropriate values in subclasses
26 nb0_ref = None
25 nb0_ref = None
@@ -61,4 +60,4 b' class NBFormatTestCase(TestCase):'
61 nb = self.mod.read(f)
60 nb = self.mod.read(f)
62
61
63
62
64
63
@@ -10,7 +10,7 b' from . import formattest'
10 from .nbexamples import nb0
10 from .nbexamples import nb0
11
11
12
12
13 class TestJSON(formattest.NBFormatTestCase):
13 class TestJSON(formattest.NBFormatTest, TestCase):
14
14
15 nb0_ref = None
15 nb0_ref = None
16 ext = 'ipynb'
16 ext = 'ipynb'
@@ -1,11 +1,14 b''
1 # -*- coding: utf8 -*-
1 # -*- coding: utf8 -*-
2
3 from unittest import TestCase
4
2 from . import formattest
5 from . import formattest
3
6
4 from .. import nbpy
7 from .. import nbpy
5 from .nbexamples import nb0, nb0_py
8 from .nbexamples import nb0, nb0_py
6
9
7
10
8 class TestPy(formattest.NBFormatTestCase):
11 class TestPy(formattest.NBFormatTest, TestCase):
9
12
10 nb0_ref = nb0_py
13 nb0_ref = nb0_py
11 ext = 'py'
14 ext = 'py'
General Comments 0
You need to be logged in to leave comments. Login now