##// END OF EJS Templates
Merge pull request #3323 from takluyver/strip-prompts...
Merge pull request #3323 from takluyver/strip-prompts Strip prompts even if the prompt isn't present on the first line. Users (including me) often copy and paste examples from just after the first prompt. This checks for prompts in the first two lines of a block, but if they aren't found there, it will ignore prompt-like prefixes in later lines, to minimise interference with multi-line strings etc. This fixes both incoming copies (transformed before running code) and outgoing (copied from the Qt console). Closes #3206

File last commit:

r7874:4a6836ce
r10679:689d7bfc merge
Show More
test_nbpy.py
17 lines | 319 B | text/x-python | PythonLexer
from unittest import TestCase
from ..nbbase import (
NotebookNode,
new_code_cell, new_text_cell, new_worksheet, new_notebook
)
from ..nbpy import reads, writes
from .nbexamples import nb0, nb0_py
class TestPy(TestCase):
def test_write(self):
s = writes(nb0)
self.assertEqual(s,nb0_py)