Show More
@@ -11,6 +11,7 b' import os' | |||||
11 | import sys |
|
11 | import sys | |
12 | import tempfile |
|
12 | import tempfile | |
13 | from datetime import datetime |
|
13 | from datetime import datetime | |
|
14 | import sqlite3 | |||
14 |
|
15 | |||
15 | # third party |
|
16 | # third party | |
16 | import nose.tools as nt |
|
17 | import nose.tools as nt | |
@@ -19,11 +20,13 b' import nose.tools as nt' | |||||
19 | from traitlets.config.loader import Config |
|
20 | from traitlets.config.loader import Config | |
20 | from IPython.utils.tempdir import TemporaryDirectory |
|
21 | from IPython.utils.tempdir import TemporaryDirectory | |
21 | from IPython.core.history import HistoryManager, extract_hist_ranges |
|
22 | from IPython.core.history import HistoryManager, extract_hist_ranges | |
|
23 | from IPython.testing.decorators import skipif | |||
22 | from IPython.utils import py3compat |
|
24 | from IPython.utils import py3compat | |
23 |
|
25 | |||
24 | def setUp(): |
|
26 | def setUp(): | |
25 | nt.assert_equal(sys.getdefaultencoding(), "utf-8" if py3compat.PY3 else "ascii") |
|
27 | nt.assert_equal(sys.getdefaultencoding(), "utf-8" if py3compat.PY3 else "ascii") | |
26 |
|
28 | |||
|
29 | @skipif(sqlite3.sqlite_version_info > (3,24,0)) | |||
27 | def test_history(): |
|
30 | def test_history(): | |
28 | ip = get_ipython() |
|
31 | ip = get_ipython() | |
29 | with TemporaryDirectory() as tmpdir: |
|
32 | with TemporaryDirectory() as tmpdir: | |
@@ -41,7 +44,7 b' def test_history():' | |||||
41 | ip.history_manager.store_output(3) |
|
44 | ip.history_manager.store_output(3) | |
42 |
|
45 | |||
43 | nt.assert_equal(ip.history_manager.input_hist_raw, [''] + hist) |
|
46 | nt.assert_equal(ip.history_manager.input_hist_raw, [''] + hist) | |
44 |
|
47 | |||
45 | # Detailed tests for _get_range_session |
|
48 | # Detailed tests for _get_range_session | |
46 | grs = ip.history_manager._get_range_session |
|
49 | grs = ip.history_manager._get_range_session | |
47 | nt.assert_equal(list(grs(start=2,stop=-1)), list(zip([0], [2], hist[1:-1]))) |
|
50 | nt.assert_equal(list(grs(start=2,stop=-1)), list(zip([0], [2], hist[1:-1]))) | |
@@ -51,7 +54,7 b' def test_history():' | |||||
51 | # Check whether specifying a range beyond the end of the current |
|
54 | # Check whether specifying a range beyond the end of the current | |
52 | # session results in an error (gh-804) |
|
55 | # session results in an error (gh-804) | |
53 | ip.magic('%hist 2-500') |
|
56 | ip.magic('%hist 2-500') | |
54 |
|
57 | |||
55 | # Check that we can write non-ascii characters to a file |
|
58 | # Check that we can write non-ascii characters to a file | |
56 | ip.magic("%%hist -f %s" % os.path.join(tmpdir, "test1")) |
|
59 | ip.magic("%%hist -f %s" % os.path.join(tmpdir, "test1")) | |
57 | ip.magic("%%hist -pf %s" % os.path.join(tmpdir, "test2")) |
|
60 | ip.magic("%%hist -pf %s" % os.path.join(tmpdir, "test2")) | |
@@ -86,6 +89,7 b' def test_history():' | |||||
86 | nt.assert_equal(list(gothist), expected) |
|
89 | nt.assert_equal(list(gothist), expected) | |
87 |
|
90 | |||
88 | # Check get_hist_search |
|
91 | # Check get_hist_search | |
|
92 | ||||
89 | gothist = ip.history_manager.search("*test*") |
|
93 | gothist = ip.history_manager.search("*test*") | |
90 | nt.assert_equal(list(gothist), [(1,2,hist[1])] ) |
|
94 | nt.assert_equal(list(gothist), [(1,2,hist[1])] ) | |
91 |
|
95 |
General Comments 0
You need to be logged in to leave comments.
Login now