##// END OF EJS Templates
Warn about .py/.json collisions in config...
Warn about .py/.json collisions in config when two versions of the config file set the same value, warn about clobbering, with a message, such as: ``` [TerminalIPythonApp] WARNING | Collisions detected in ipython_config.py and ipython_config.json config files. ipython_config.json has higher priority: { "Klass": { "trait": "'python' ignored, using 'json'" } } ``` In anticipation of more machine-written .json config

File last commit:

r18757:a9db78eb
r19160:f22c8070
Show More
test_paths.py
61 lines | 1.3 KiB | text/x-python | PythonLexer
import re
import nose.tools as nt
from IPython.html.base.handlers import path_regex, notebook_path_regex
try: # py3
assert_regex = nt.assert_regex
assert_not_regex = nt.assert_not_regex
except AttributeError: # py2
assert_regex = nt.assert_regexp_matches
assert_not_regex = nt.assert_not_regexp_matches
# build regexps that tornado uses:
path_pat = re.compile('^' + '/x%s' % path_regex + '$')
nb_path_pat = re.compile('^' + '/y%s' % notebook_path_regex + '$')
def test_path_regex():
for path in (
'/x',
'/x/',
'/x/foo',
'/x/foo.ipynb',
'/x/foo/bar',
'/x/foo/bar.txt',
):
assert_regex(path, path_pat)
def test_path_regex_bad():
for path in (
'/xfoo',
'/xfoo/',
'/xfoo/bar',
'/xfoo/bar/',
'/x/foo/bar/',
'/x//foo',
'/y',
'/y/x/foo',
):
assert_not_regex(path, path_pat)
def test_notebook_path_regex():
for path in (
'/y/asdf.ipynb',
'/y/foo/bar.ipynb',
'/y/a/b/c/d/e.ipynb',
):
assert_regex(path, nb_path_pat)
def test_notebook_path_regex_bad():
for path in (
'/y',
'/y/',
'/y/.ipynb',
'/y/foo/.ipynb',
'/y/foo/bar',
'/yfoo.ipynb',
'/yfoo/bar.ipynb',
):
assert_not_regex(path, nb_path_pat)