##// END OF EJS Templates
Merge remote-tracking branch 'origin' into HEAD
luciana -
r24712:19a59291 merge
parent child Browse files
Show More
@@ -803,7 +803,9 b' class InteractiveShell(SingletonConfigurable):'
803 This will allow deprecation warning of function used interactively to show
803 This will allow deprecation warning of function used interactively to show
804 warning to users, and still hide deprecation warning from libraries import.
804 warning to users, and still hide deprecation warning from libraries import.
805 """
805 """
806 warnings.filterwarnings("default", category=DeprecationWarning, module=self.user_ns.get("__name__"))
806 if sys.version_info < (3,7):
807 warnings.filterwarnings("default", category=DeprecationWarning, module=self.user_ns.get("__name__"))
808
807
809
808 def init_builtins(self):
810 def init_builtins(self):
809 # A single, static flag that we set to True. Its presence indicates
811 # A single, static flag that we set to True. Its presence indicates
@@ -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,10 +20,12 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
24
23 def setUp():
25 def setUp():
24 nt.assert_equal(sys.getdefaultencoding(), "utf-8")
26 nt.assert_equal(sys.getdefaultencoding(), "utf-8")
25
27
28 @skipif(sqlite3.version_info > (3,24,0))
26 def test_history():
29 def test_history():
27 ip = get_ipython()
30 ip = get_ipython()
28 with TemporaryDirectory() as tmpdir:
31 with TemporaryDirectory() as tmpdir:
@@ -40,7 +43,7 b' def test_history():'
40 ip.history_manager.store_output(3)
43 ip.history_manager.store_output(3)
41
44
42 nt.assert_equal(ip.history_manager.input_hist_raw, [''] + hist)
45 nt.assert_equal(ip.history_manager.input_hist_raw, [''] + hist)
43
46
44 # Detailed tests for _get_range_session
47 # Detailed tests for _get_range_session
45 grs = ip.history_manager._get_range_session
48 grs = ip.history_manager._get_range_session
46 nt.assert_equal(list(grs(start=2,stop=-1)), list(zip([0], [2], hist[1:-1])))
49 nt.assert_equal(list(grs(start=2,stop=-1)), list(zip([0], [2], hist[1:-1])))
@@ -50,7 +53,7 b' def test_history():'
50 # Check whether specifying a range beyond the end of the current
53 # Check whether specifying a range beyond the end of the current
51 # session results in an error (gh-804)
54 # session results in an error (gh-804)
52 ip.magic('%hist 2-500')
55 ip.magic('%hist 2-500')
53
56
54 # Check that we can write non-ascii characters to a file
57 # Check that we can write non-ascii characters to a file
55 ip.magic("%%hist -f %s" % os.path.join(tmpdir, "test1"))
58 ip.magic("%%hist -f %s" % os.path.join(tmpdir, "test1"))
56 ip.magic("%%hist -pf %s" % os.path.join(tmpdir, "test2"))
59 ip.magic("%%hist -pf %s" % os.path.join(tmpdir, "test2"))
@@ -85,6 +88,7 b' def test_history():'
85 nt.assert_equal(list(gothist), expected)
88 nt.assert_equal(list(gothist), expected)
86
89
87 # Check get_hist_search
90 # Check get_hist_search
91
88 gothist = ip.history_manager.search("*test*")
92 gothist = ip.history_manager.search("*test*")
89 nt.assert_equal(list(gothist), [(1,2,hist[1])] )
93 nt.assert_equal(list(gothist), [(1,2,hist[1])] )
90
94
General Comments 0
You need to be logged in to leave comments. Login now