MCPcopy Create free account
hub / github.com/ipython/ipython / test_file_unicode

Function test_file_unicode

IPython/core/tests/test_magic.py:907–919  ·  view source on GitHub ↗

%%writefile with unicode cell

()

Source from the content-addressed store, hash-verified

905 nt.assert_in('line2', s)
906
907def test_file_unicode():
908 """%%writefile with unicode cell"""
909 ip = get_ipython()
910 with TemporaryDirectory() as td:
911 fname = os.path.join(td, 'file1')
912 ip.run_cell_magic("writefile", fname, u'\n'.join([
913 u'liné1',
914 u'liné2',
915 ]))
916 with io.open(fname, encoding='utf-8') as f:
917 s = f.read()
918 nt.assert_in(u'liné1\n', s)
919 nt.assert_in(u'liné2', s)
920
921def test_file_amend():
922 """%%writefile -a amends files"""

Callers

nothing calls this directly

Calls 3

get_ipythonFunction · 0.90
run_cell_magicMethod · 0.80
readMethod · 0.80

Tested by

no test coverage detected