def test_to_hdf5(self):
        """Test to_hdf5."""
        random = np.random.rand(2, 2, 2, 2)

        ints = TwoBodyElectronicIntegrals(ElectronicBasis.MO,
                                          (random, random, random, random))

        with tempfile.TemporaryFile() as tmp_file:
            with h5py.File(tmp_file, "w") as file:
                ints.to_hdf5(file)
    def test_from_hdf5(self):
        """Test from_hdf5."""
        random = np.random.rand(2, 2, 2, 2)

        ints = TwoBodyElectronicIntegrals(ElectronicBasis.MO,
                                          (random, random, random, random))

        with tempfile.TemporaryFile() as tmp_file:
            with h5py.File(tmp_file, "w") as file:
                ints.to_hdf5(file)

            with h5py.File(tmp_file, "r") as file:
                new_ints = TwoBodyElectronicIntegrals.from_hdf5(
                    file["TwoBodyElectronicIntegrals"])

                self.assertEqual(ints, new_ints)