# 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
CONTAINS

SUBROUTINE subf(argx)
INTEGER :: argx
END SUBROUTINE subf

END SUBROUTINE f

END MODULE testa
'''
    tree = api.parse(source_str, isfree=True, isstrict=False,
                     ignore_comments=False)
    r = str(tree).strip()
    assert r.split('\n')[1:]=='''
...!BEGINSOURCE <cStringIO.StringI object at 0x139f8a0> mode=free
  MODULE testa

    CONTAINS

    SUBROUTINE f(arga)
      INTEGER arga

      CONTAINS

      SUBROUTINE subf(argx)
        INTEGER argx
      END SUBROUTINE subf

    END SUBROUTINE f


# 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_issue25.py
from fparser import api

CONTAINS

SUBROUTINE subf(argx)
INTEGER :: argx
END SUBROUTINE subf

END SUBROUTINE f

END MODULE testa
'''
    tree = api.parse(source_str, isfree=True, isstrict=False,
                     ignore_comments=False)
    r = str(tree).strip()
    assert r.split('\n')[1:]=='''
...!BEGINSOURCE <cStringIO.StringI object at 0x139f8a0> mode=free
  MODULE testa

    CONTAINS

    SUBROUTINE f(arga)
      INTEGER arga

      CONTAINS

      SUBROUTINE subf(argx)
        INTEGER argx
      END SUBROUTINE subf

    END SUBROUTINE f


  END MODULE testa