def test_isSES3DFile(): """ Tests the isSES3D File function. """ ses3d_files = ["File_theta", "File_phi", "File_r"] ses3d_files = [os.path.join(data_dir, _i) for _i in ses3d_files] for waveform_file in ses3d_files: assert is_SES3D(waveform_file) # Get some arbitrary other files and assert they are false. package_dir = os.path.join(os.path.dirname(os.path.abspath( inspect.getfile(inspect.currentframe()))), os.pardir) other_files = glob(os.path.join(package_dir, "*.py")) for other_file in other_files: assert not is_SES3D(other_file)
def test_isSES3DFileWithStringIO(): """ Same as test_isSES3DFile() but testing from StringIO's """ ses3d_files = ["File_theta", "File_phi", "File_r"] ses3d_files = [os.path.join(data_dir, _i) for _i in ses3d_files] for waveform_file in ses3d_files: with open(waveform_file, "r") as open_file: waveform_file = StringIO(open_file.read()) assert is_SES3D(waveform_file) waveform_file.close() # Get some arbitrary other files and assert they are false. package_dir = os.path.join(os.path.dirname(os.path.abspath( inspect.getfile(inspect.currentframe()))), os.pardir) other_files = glob(os.path.join(package_dir, "*.py")) for other_file in other_files: with open(other_file, "r") as open_file: other_file = StringIO(open_file.read()) assert not is_SES3D(other_file) other_file.close()