Show More
@@ -738,11 +738,11 b' class CellMagicTestCase(TestCase):' | |||||
738 | nt.assert_equal(c33, None) |
|
738 | nt.assert_equal(c33, None) | |
739 |
|
739 | |||
740 | def test_file(): |
|
740 | def test_file(): | |
741 | """Basic %%file""" |
|
741 | """Basic %%writefile""" | |
742 | ip = get_ipython() |
|
742 | ip = get_ipython() | |
743 | with TemporaryDirectory() as td: |
|
743 | with TemporaryDirectory() as td: | |
744 | fname = os.path.join(td, 'file1') |
|
744 | fname = os.path.join(td, 'file1') | |
745 | ip.run_cell_magic("file", fname, u'\n'.join([ |
|
745 | ip.run_cell_magic("writefile", fname, u'\n'.join([ | |
746 | 'line1', |
|
746 | 'line1', | |
747 | 'line2', |
|
747 | 'line2', | |
748 | ])) |
|
748 | ])) | |
@@ -752,12 +752,12 b' def test_file():' | |||||
752 | nt.assert_in('line2', s) |
|
752 | nt.assert_in('line2', s) | |
753 |
|
753 | |||
754 | def test_file_var_expand(): |
|
754 | def test_file_var_expand(): | |
755 | """%%file $filename""" |
|
755 | """%%writefile $filename""" | |
756 | ip = get_ipython() |
|
756 | ip = get_ipython() | |
757 | with TemporaryDirectory() as td: |
|
757 | with TemporaryDirectory() as td: | |
758 | fname = os.path.join(td, 'file1') |
|
758 | fname = os.path.join(td, 'file1') | |
759 | ip.user_ns['filename'] = fname |
|
759 | ip.user_ns['filename'] = fname | |
760 | ip.run_cell_magic("file", '$filename', u'\n'.join([ |
|
760 | ip.run_cell_magic("writefile", '$filename', u'\n'.join([ | |
761 | 'line1', |
|
761 | 'line1', | |
762 | 'line2', |
|
762 | 'line2', | |
763 | ])) |
|
763 | ])) | |
@@ -767,11 +767,11 b' def test_file_var_expand():' | |||||
767 | nt.assert_in('line2', s) |
|
767 | nt.assert_in('line2', s) | |
768 |
|
768 | |||
769 | def test_file_unicode(): |
|
769 | def test_file_unicode(): | |
770 | """%%file with unicode cell""" |
|
770 | """%%writefile with unicode cell""" | |
771 | ip = get_ipython() |
|
771 | ip = get_ipython() | |
772 | with TemporaryDirectory() as td: |
|
772 | with TemporaryDirectory() as td: | |
773 | fname = os.path.join(td, 'file1') |
|
773 | fname = os.path.join(td, 'file1') | |
774 | ip.run_cell_magic("file", fname, u'\n'.join([ |
|
774 | ip.run_cell_magic("writefile", fname, u'\n'.join([ | |
775 | u'liné1', |
|
775 | u'liné1', | |
776 | u'liné2', |
|
776 | u'liné2', | |
777 | ])) |
|
777 | ])) | |
@@ -781,15 +781,15 b' def test_file_unicode():' | |||||
781 | nt.assert_in(u'liné2', s) |
|
781 | nt.assert_in(u'liné2', s) | |
782 |
|
782 | |||
783 | def test_file_amend(): |
|
783 | def test_file_amend(): | |
784 | """%%file -a amends files""" |
|
784 | """%%writefile -a amends files""" | |
785 | ip = get_ipython() |
|
785 | ip = get_ipython() | |
786 | with TemporaryDirectory() as td: |
|
786 | with TemporaryDirectory() as td: | |
787 | fname = os.path.join(td, 'file2') |
|
787 | fname = os.path.join(td, 'file2') | |
788 | ip.run_cell_magic("file", fname, u'\n'.join([ |
|
788 | ip.run_cell_magic("writefile", fname, u'\n'.join([ | |
789 | 'line1', |
|
789 | 'line1', | |
790 | 'line2', |
|
790 | 'line2', | |
791 | ])) |
|
791 | ])) | |
792 | ip.run_cell_magic("file", "-a %s" % fname, u'\n'.join([ |
|
792 | ip.run_cell_magic("writefile", "-a %s" % fname, u'\n'.join([ | |
793 | 'line3', |
|
793 | 'line3', | |
794 | 'line4', |
|
794 | 'line4', | |
795 | ])) |
|
795 | ])) |
General Comments 0
You need to be logged in to leave comments.
Login now