def METHOD_NAME(self):
    for test_case in [
        {
            "attribute_name": "tolerations",
            "expect_failure": True,
            "attribute": [
                {
                    "key": "test1",
                    "operator": "Exists",
                    "effect": "NoSchedule",
                    "toleration_seconds": 3600,
                },
            ],
        },
        {
            "attribute_name": "tolerations",
            "expect_failure": False,
            "attribute": {
                "key": "test1",
                "operator": "Exists",
                "effect": "NoSchedule",
                "tolerationSeconds": 3600,
            },
            "expected_attribute": self._generate_tolerations(),
        },
        {
            "attribute_name": "tolerations",
            "expect_failure": False,
            "attribute": self._generate_toleration(),
            "expected_attribute": self._generate_tolerations(),
        },
        {
            "attribute_name": "tolerations",
            "expect_failure": False,
            "attribute": self._generate_tolerations(),
            "expected_attribute": self._generate_tolerations(),
        },
        {
            "attribute_name": "affinity",
            "expect_failure": False,
            "attribute": self._generate_affinity(),
            "expected_attribute": self._generate_affinity(),
        },
        {
            "attribute_name": "affinity",
            "expect_failure": True,
            "attribute": self._generate_affinity().to_dict(),
        },
        {
            "attribute_name": "affinity",
            "expect_failure": False,
            "attribute": self.api.sanitize_for_serialization(
                self._generate_affinity()
            ),
            "expected_attribute": self._generate_affinity(),
        },
        {
            "attribute_name": "affinity",
            "expect_failure": False,
            "attribute": None,
            "expected_attribute": None,
        },
    ]:
        attribute_name = test_case.get("attribute_name")
        attribute = test_case.get("attribute")
        expect_failure = test_case.get("expect_failure", False)
        expected_attribute = test_case.get("expected_attribute")
        kube_resource = mlrun.runtimes.pod.KubeResource()
        if expect_failure:
            with pytest.raises(mlrun.errors.MLRunInvalidArgumentTypeError):
                self._set_with_node_selection(
                    kube_resource, attribute_name, attribute
                )
        else:
            self._set_with_node_selection(kube_resource, attribute_name, attribute)
            assert (
                deepdiff.DeepDiff(
                    getattr(kube_resource.spec, attribute_name),
                    expected_attribute,
                    ignore_order=True,
                )
                == {}
            )