def METHOD_NAME(
    self,
    device_attr_list,
    should_warn,
    expected_regex,
    policy_name="mixed_float16",
):
    with tf.compat.v1.test.mock.patch.object(
        tf_logging, "warning"
    ) as mock_warn, tf.compat.v1.test.mock.patch.object(
        tf_logging, "info"
    ) as mock_info:
        device_compatibility_check._log_device_compatibility_check(
            policy_name, device_attr_list
        )
    if should_warn:
        self.assertRegex(mock_warn.call_args[0][0], expected_regex)
        mock_info.assert_not_called()
    else:
        self.assertRegex(mock_info.call_args[0][0], expected_regex)
        mock_warn.assert_not_called()