def METHOD_NAME(self, d, mode):
    if mode not in [
        "structure optimization",
        "static dielectric",
        "raman_0_0.005",
        "raman analysis",
    ]:
        raise ValueError("Invalid mode!")
    if mode not in ["raman analysis"]:
        self.assertEqual(d["formula_pretty"], "Si")
        self.assertEqual(d["formula_anonymous"], "A")
        self.assertEqual(d["nelements"], 1)
        self.assertEqual(d["state"], "successful")
        self.assertAlmostEqual(
            d["calcs_reversed"][0]["output"]["structure"]["lattice"]["a"], 3.867, 2
        )
    if mode in ["structure optimization"]:
        self.assertAlmostEqual(d["output"]["energy"], -10.850, 2)
        self.assertAlmostEqual(d["output"]["energy_per_atom"], -5.425, 2)
    elif mode in ["static dielectric"]:
        epsilon = [
            [13.23245131, -1.98e-06, -1.4e-06],
            [-1.98e-06, 13.23245913, 8.38e-06],
            [-1.4e-06, 8.38e-06, 13.23245619],
        ]
        np.testing.assert_allclose(
            epsilon, d["output"]["epsilon_static"], rtol=1e-5
        )
    elif mode in ["raman_0_0.005"]:
        epsilon = [
            [13.16509632, 0.00850098, 0.00597267],
            [0.00850097, 13.25477303, -0.02979572],
            [0.00597267, -0.0297953, 13.28883867],
        ]
        np.testing.assert_allclose(
            epsilon, d["output"]["epsilon_static"], rtol=1e-5
        )
    elif mode in ["raman analysis"]:
        freq = [
            82.13378641656142,
            82.1337379843688,
            82.13373236539397,
            3.5794336040310436e-07,
            3.872360276932139e-07,
            1.410955723105983e-06,
        ]
        np.testing.assert_allclose(freq, d["frequencies"], rtol=1e-5)
        raman_tensor = {
            "0": [
                [-0.14893062387265346, 0.01926196125448702, 0.013626954435454657],
                [0.019262321540910236, 0.03817444467845385, -0.06614541890150054],
                [0.013627229948601821, -0.06614564143135017, 0.11078513986463052],
            ],
            "1": [
                [-0.021545749071077102, -0.12132200642389818, -0.08578776196143767],
                [-0.12131975993142007, -0.00945267872479081, -0.004279822490713417],
                [-0.08578678706847546, -0.004279960247327641, 0.032660281203217366],
            ],
        }
        np.testing.assert_allclose(
            raman_tensor["0"], d["raman_tensor"]["0"], rtol=1e-5
        )
        np.testing.assert_allclose(
            raman_tensor["1"], d["raman_tensor"]["1"], rtol=1e-5
        )