# Path: fparser/api.py
# def get_reader(input, isfree=None, isstrict=None, include_dirs = None, source_only = None,
#                ignore_comments = True):
# def parse(input, isfree=None, isstrict=None, include_dirs = None, source_only = None,
#           ignore_comments = True, analyze=True):
# def walk(stmt, depth=-1, _initial_depth = None):


from fparser import api

def test_Issue_r25_1():
    source_str = """
      subroutine rsedit()
        print 311
  311   format(/
     .  t4,'read [fn]',t15,

     .  t14,'  Third argument = flip: exchange n+, n- ')
      end

    """
    tree = api.parse(source_str, isfree=False, isstrict=False,
                     ignore_comments=False)
    assert str(tree).strip().split('\n')[1:]=="""
      !      BEGINSOURCE <cStringIO.StringI object at 0x121bab0> mode=fix90

        SUBROUTINE rsedit()
          PRINT 311
 311      FORMAT (/  t4, 'read [fn]', t15, t14, '  Third argument = flip: exchange n+, n- ')

        END SUBROUTINE rsedit
    """.strip().split('\n')[1:]

def test_comment_4():
    source_str = """
      subroutine m_struc_def()
 !abc test
      end
    """

# Path: fparser/api.py
# def get_reader(input, isfree=None, isstrict=None, include_dirs = None, source_only = None,
#                ignore_comments = True):
# def parse(input, isfree=None, isstrict=None, include_dirs = None, source_only = None,
#           ignore_comments = True, analyze=True):
# def walk(stmt, depth=-1, _initial_depth = None):


# Path: fparser/tests/test_issue8.py
from fparser import api


def test_Issue_r25_1():
    source_str = """
      subroutine rsedit()
        print 311
  311   format(/
     .  t4,'read [fn]',t15,

     .  t14,'  Third argument = flip: exchange n+, n- ')
      end

    """
    tree = api.parse(source_str, isfree=False, isstrict=False,
                     ignore_comments=False)
    assert str(tree).strip().split('\n')[1:]=="""
      !      BEGINSOURCE <cStringIO.StringI object at 0x121bab0> mode=fix90

        SUBROUTINE rsedit()
          PRINT 311
 311      FORMAT (/  t4, 'read [fn]', t15, t14, '  Third argument = flip: exchange n+, n- ')

        END SUBROUTINE rsedit
    """.strip().split('\n')[1:]

def test_comment_4():
    source_str = """
      subroutine m_struc_def()
 !abc test
      end
    """

    tree = api.parse(source_str, isfree=False, isstrict=False,