
from metakernel.tests.utils import (get_kernel, get_log_text, 
                                    clear_log_text, EvalKernel)

def test_edit_magic():
    kernel = get_kernel(EvalKernel)
    results = kernel.do_execute("%edit LICENSE.txt")
    text = results["payload"][0]["text"]
    assert '%%file LICENSE.txt\n\n# Copyright (c) Ipython Kernel Development Team.\n# Distributed under the terms of the Modified BSD License.\n\n\n# Copyright (c) Metakernel Development Team.\n# Distributed under the terms of the Modified BSD License.\n\n' == text, text


@@ -181,16 +181,17 @@
 Kernel)%0A
+%0A
     resu
@@ -220,25 +220,28 @@
 e(%22%25
+%25
 edit 
-LICENSE.txt%22
+%25s%22 %25 __file__
 )%0A  
@@ -294,266 +294,71 @@
 ert 
-'%25%25file LICENSE.txt%5Cn%5Cn# Copyright (c) Ipython Kernel Development Team.%5Cn# Distributed under the terms of the Modified BSD License.%5Cn%5Cn%5Cn# Copyright (c) Metakernel Development Team.%5Cn# Distributed under the terms of the Modified BSD License.%5Cn%5Cn' == text, text%0A
+text.startswith('%25%25file')%0A    assert 'def test_edit_magic' in text
 %0A

Fix test edit magic test