ocket8888 commented on code in PR #7424: URL: https://github.com/apache/trafficcontrol/pull/7424#discussion_r1162047419
########## traffic_ops/testing/api_contract/v4/test_cachegroups.py: ########## @@ -60,30 +64,40 @@ def test_cachegroup_contract(to_session: TOSession, request_template_data: if not isinstance(first_cachegroup, dict): raise TypeError("malformed API response; first Cache group in response is not an object") cachegroup_keys = set(first_cachegroup.keys()) - logger.info("Cache group Keys from cachegroup endpoint response %s", cachegroup_keys) - response_template = response_template_data.get("cachegroup").get("properties") + + cachegroup_response_template = response_template_data.get("cachegroup") + response_template = cachegroup_response_template.get("properties") if isinstance( + cachegroup_response_template, dict) else None + if response_template is None or not isinstance(response_template, dict): Review Comment: Checking if an `object` is of type `dict` guards the type so that it narrows to `dict[Unknown, Unknown]`. So there are still some typing issues stemming from the fact that beyond this point the type of `response_template` is partially `Unknown`, meaning that when you do `.items` below, the returned key and value are both `Unknown`, which also is infecting everything you do with them. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@trafficcontrol.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org