From 5ae50772751967272147f30e9e4f6519ecc2059d Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Sat, 4 Feb 2012 23:13:46 +0000 Subject: [PATCH] Add test for writing non-ascii characters to file with %hist. --- IPython/core/tests/test_history.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/IPython/core/tests/test_history.py b/IPython/core/tests/test_history.py index 5b485cfefd7..99f3a8333f8 100644 --- a/IPython/core/tests/test_history.py +++ b/IPython/core/tests/test_history.py @@ -7,6 +7,7 @@ # stdlib import os +import shutil import sys import tempfile import unittest @@ -51,6 +52,14 @@ def test_history(): # Check whether specifying a range beyond the end of the current # session results in an error (gh-804) ip.magic('%hist 2-500') + + # Check that we can write non-ascii characters to a file + tmpdir = tempfile.mkdtemp() + try: + ip.magic("%%hist -f %s" % os.path.join(tmpdir, "test1")) + ip.magic("%%save %s 1-10" % os.path.join(tmpdir, "test2")) + finally: + shutil.rmtree(tmpdir) # New session ip.history_manager.reset()