def test_saving_a_file(self): x = np.linspace(-5, 5, 100) y = x ** 2 spec = Spectrum(x, y) filename = os.path.join(data_path, "test.dat") spec.save(filename) spec2 = Spectrum() spec2.load(filename) spec2_x, spec2_y = spec2.data self.array_almost_equal(spec2_x, x) self.array_almost_equal(spec2_y, y) os.remove(filename)