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