def _test_class(self, obj, check_details):
        """Test that the object is created correctly

        :param obj: object to be tested
        :param check_details: how to check the object's details value.
                             One of SAME_CL_DETAILS, DIFF_CL_DETAILS,
                             SAME_CL_MSG, SAME_DETAILS

        """
        obj_info = "object info = %s" % obj.__dict__
        cls = obj.__class__
        d = obj.serialize()

        self.assertEqual(cls.__name__, obj.type, obj_info)
        self.assertEqual(cls.status_code, obj.code, obj_info)
        self.assertEqual(cls.message, obj.message, obj_info)

        self.assertEqual(cls.__name__, d['type'], obj_info)
        self.assertEqual(cls.status_code, d['code'], obj_info)
        self.assertEqual(cls.message, d['message'], obj_info)
        self.assertEqual(obj.details, d['details'], obj_info)

        if check_details == SAME_CL_DETAILS:
            self.assertEqual(cls.details, obj.details, obj_info)
        elif check_details == DIFF_CL_DETAILS:
            self.assertNotEqual(cls.details, obj.details, obj_info)
        elif check_details == SAME_CL_MSG:
            self.assertEqual(cls.message, obj.details, obj_info)
        elif check_details == SAME_DETAILS:
            self.assertEqual(DETAILS, obj.details, obj_info)
        elif check_details == DEFAULT_DETAILS:
            self.assertEqual(errors.RESTError.details, obj.details, obj_info)
        else:
            self.fail("unexpected value for check_details: %(chk)s, %(info)s" %
                      {'info': obj_info, 'chk': check_details})
dataset/ETHPy150Open openstack/ironic-python-agent/ironic_python_agent/tests/unit/test_errors.py/TestErrors._test_class/original