Skip to content

Commit

Permalink
BF: fix for new Sphinx output format
Browse files Browse the repository at this point in the history
Doctest block changed.
  • Loading branch information
Travis CI User committed Dec 31, 2019
1 parent fb1097a commit e4d0e3e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions nb2plots/tests/test_nbplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

HERE = dirname(__file__)

# Variation in doctest block.
DOCTEST_BLOCK_RE = r'<doctest_block (classes="doctest" )?xml:space="preserve">'


def get_otherpage(fname):
with open(pjoin(HERE, 'otherpages', fname), 'rt') as fobj:
Expand Down Expand Up @@ -639,7 +642,7 @@ def test_pages(self):
<title>
A title
<nbplot_container>
<doctest_block xml:space="preserve">
{DOCTEST_BLOCK_RE}
>>> # always
>>> a = 'default'
<nbplot_epilogue>
Expand All @@ -649,7 +652,7 @@ def test_pages(self):
<paragraph>
Some text
<nbplot_container>
<doctest_block xml:space="preserve">
{DOCTEST_BLOCK_RE}
>>> a = 'skip is False'
<nbplot_epilogue>
<comment xml:space="preserve">
Expand All @@ -658,7 +661,7 @@ def test_pages(self):
<paragraph>
Keep text coming
<nbplot_container>
<doctest_block xml:space="preserve">
{DOCTEST_BLOCK_RE}
>>> b = 'skip appears to be False'
>>> a == 'skip is False'
True
Expand All @@ -669,10 +672,10 @@ def test_pages(self):
<paragraph>
Text continues
<nbplot_container>
<doctest_block xml:space="preserve">
{DOCTEST_BLOCK_RE}
>>> # doctest only run when skip flag False, always rendered
>>> b == 'skip appears to be False'
True""")
True""".format(**globals()))
assert(regex.match(p_xml) is not None)


Expand Down Expand Up @@ -708,7 +711,7 @@ def test_pages(self):
<title>
A title
<nbplot_container>
<doctest_block xml:space="preserve">
{DOCTEST_BLOCK_RE}
>>> # always
>>> a = 'default'
<nbplot_epilogue>
Expand All @@ -718,7 +721,7 @@ def test_pages(self):
<paragraph>
Some text
<nbplot_container>
<doctest_block xml:space="preserve">
{DOCTEST_BLOCK_RE}
>>> a = 'skip is True'
<nbplot_epilogue>
<comment xml:space="preserve">
Expand All @@ -727,7 +730,7 @@ def test_pages(self):
<paragraph>
Keep text coming
<nbplot_container>
<doctest_block xml:space="preserve">
{DOCTEST_BLOCK_RE}
>>> b = 'skip appears to be True'
>>> a == 'skip is True'
True
Expand All @@ -747,10 +750,10 @@ def test_pages(self):
<comment xml:space="preserve">
<comment xml:space="preserve">
<nbplot_container hide-from="all" show-to="doctest">
<doctest_block xml:space="preserve">
{DOCTEST_BLOCK_RE}
>>> # only when skip flag True
>>> b == 'skip appears to be True'
True""")
True""".format(**globals()))
assert(regex.match(p_xml) is not None)


Expand Down

0 comments on commit e4d0e3e

Please sign in to comment.