This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
1,001 additions
and
22 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
|
||
.. _b-textdiff: | ||
|
||
.. blogpost:: | ||
:title: A magic command to visualize differences between two files in a notebook | ||
:keywords: diffview, difflib.js, differences, textdiff | ||
:date: 2015-04-23 | ||
:categories: javascript, notebook | ||
|
||
The magic command :meth:`textdiff <pyensae.file_helper.magic_file.MagicFile.textdiff>` | ||
makes it easy to display the differences between two files or two strings. | ||
|
||
.. image:: diffviewm.png | ||
|
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
""" | ||
@brief test log(time=7s) | ||
""" | ||
|
||
import sys | ||
import os | ||
import unittest | ||
import re | ||
|
||
try: | ||
import src | ||
import pyquickhelper | ||
except ImportError: | ||
path = os.path.normpath( | ||
os.path.abspath( | ||
os.path.join( | ||
os.path.split(__file__)[0], | ||
"..", | ||
".."))) | ||
if path not in sys.path: | ||
sys.path.append(path) | ||
path = os.path.normpath( | ||
os.path.abspath( | ||
os.path.join( | ||
os.path.split(__file__)[0], | ||
"..", | ||
"..", | ||
"..", | ||
"pyquickhelper", | ||
"src"))) | ||
if path not in sys.path: | ||
sys.path.append(path) | ||
import src | ||
import pyquickhelper | ||
|
||
|
||
from pyquickhelper.ipythonhelper.notebook_helper import run_notebook | ||
from pyquickhelper import get_temp_folder, fLOG | ||
|
||
|
||
class TestNotebookRunner (unittest.TestCase): | ||
|
||
def test_notebook_runner(self): | ||
fLOG( | ||
__file__, | ||
self._testMethodName, | ||
OutputPrint=__name__ == "__main__") | ||
notebook = os.path.split( | ||
__file__)[-1].replace(".ipynb", "").replace(".py", "")[5:] | ||
temp = get_temp_folder(__file__, "temp_" + notebook) | ||
nbfile = os.path.join( | ||
temp, | ||
"..", | ||
"..", | ||
"..", | ||
"_doc", | ||
"notebooks", | ||
"%s.ipynb" % | ||
notebook) | ||
if not os.path.exists(nbfile): | ||
raise FileNotFoundError(nbfile) | ||
addpath = [os.path.normpath(os.path.join(temp, "..", "..", "..", "src")), | ||
os.path.normpath( | ||
os.path.join( | ||
temp, | ||
"..", | ||
"..", | ||
"..", | ||
"..", | ||
"pyquickhelper", | ||
"src")), | ||
] | ||
outfile = os.path.join(temp, "out_notebook.ipynb") | ||
assert not os.path.exists(outfile) | ||
|
||
out = run_notebook( | ||
nbfile, | ||
working_dir=temp, | ||
outfilename=outfile, | ||
additional_path=addpath) | ||
fLOG(out) | ||
assert os.path.exists(outfile) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters