From a9607a81caa4881d493053e05de70ff91fab4d57 2012-06-14 17:37:29 From: MinRK Date: 2012-06-14 17:37:29 Subject: [PATCH] add failing test for unicode cwd in prompts --- diff --git a/IPython/core/tests/test_prompts.py b/IPython/core/tests/test_prompts.py index cd9d1c3..98fbf4f 100644 --- a/IPython/core/tests/test_prompts.py +++ b/IPython/core/tests/test_prompts.py @@ -1,7 +1,10 @@ +# -*- coding: utf-8 """Tests for prompt generation.""" +import tempfile import unittest +import os import nose.tools as nt from IPython.testing import tools as tt, decorators as dec @@ -60,3 +63,15 @@ class PromptTests(unittest.TestCase): def test_render(self): self.pm.in_template = r'\#>' self.assertEqual(self.pm.render('in',color=False), '%d>' % ip.execution_count) + + def test_render_unicode(self): + td = tempfile.mkdtemp(u'ünicødé') + save = os.getcwdu() + os.chdir(td) + self.pm.in_template = r'\w [\#]' + try: + p = self.pm.render('in', color=False) + self.assertEquals(p, u"%s [%i]" % (os.getcwdu(), ip.execution_count)) + finally: + os.chdir(save) + os.rmdir(td)