def METHOD_NAME(self, testdata):
    """
    Tests that reading and writing a SCARDEC file does not change
    anything.
    This time it tests reading from and writing to open files.
    """
    filename = testdata['test.scardec']
    with open(filename, "rb") as fh:
        data = fh.read()
        fh.seek(0, 0)
        cat = obspy.read_events(fh)
    with NamedTemporaryFile() as tf:
        # raises two UserWarnings
        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter('always', UserWarning)
            cat.write(tf, format="SCARDEC")
            tf.seek(0, 0)
            new_data = tf.read()
            assert len(w) == 2
            assert w[0].category == UserWarning
            assert 'No moment wave magnitude found' in str(w[0])
            assert w[1].category == UserWarning
            assert 'No derived origin attached' in str(w[1])
    # Test file header
    assert data.decode().splitlines()[0:2] == \
        new_data.decode().splitlines()[0:2]
    for line_data, line_new in zip(data.decode().splitlines()[2:],
                                   new_data.decode().splitlines()[2:]):
        # Compare time stamps
        assert np.allclose(float(line_data.split()[0]),
                           float(line_new.split()[0]))
        # Compare moment rate values
        assert np.allclose(float(line_data.split()[1]),
                           float(line_new.split()[1]))