Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions yoti_python_sdk/doc_scan/session/retrieve/breakdown_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def __init__(self, data):
"""
self.__sub_check = data.get("sub_check", None)
self.__result = data.get("result", None)
self.__process = data.get("process", None)
self.__details = [DetailsResponse(detail) for detail in data.get("details", [])]

@property
Expand All @@ -36,6 +37,16 @@ def result(self):
"""
return self.__result

@property
def process(self):
"""
The process of the sub check

:return: the process
:rtype: str or None
"""
Comment on lines +41 to +47
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring for process is a bit unclear relative to the API meaning described in the PR (breakdown process type). Consider updating it to explicitly state this is the breakdown process type (e.g., AUTOMATED / EXPERT_REVIEW) and use consistent terminology ("sub-check" vs "sub check").

Copilot uses AI. Check for mistakes.
return self.__process

@property
def details(self):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
class BreakdownResponseTest(unittest.TestCase):
SOME_SUB_CHECK = "someSubCheck"
SOME_RESULT = "someResult"
SOME_PROCESS = "AUTOMATED"
SOME_DETAILS = [
{"name": "firstDetailName", "value": "firstDetailValue"},
{"name": "secondDetailName", "value": "secondDetailValue"},
Expand All @@ -17,20 +18,23 @@ def test_should_build_correctly(self):
data = {
"sub_check": self.SOME_SUB_CHECK,
"result": self.SOME_RESULT,
"process": self.SOME_PROCESS,
"details": self.SOME_DETAILS,
}

result = BreakdownResponse(data)

assert result.sub_check is self.SOME_SUB_CHECK
assert result.result is self.SOME_RESULT
assert result.process is self.SOME_PROCESS
Comment on lines 27 to +29
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These assertions use is for string comparison. is checks object identity and can be flaky depending on interning; use == for comparing the returned string values (sub_check, result, process). Keep is None only for None checks.

Suggested change
assert result.sub_check is self.SOME_SUB_CHECK
assert result.result is self.SOME_RESULT
assert result.process is self.SOME_PROCESS
assert result.sub_check == self.SOME_SUB_CHECK
assert result.result == self.SOME_RESULT
assert result.process == self.SOME_PROCESS

Copilot uses AI. Check for mistakes.
assert len(result.details) == 2
assert result.details[0].name == "firstDetailName"
assert result.details[0].value == "firstDetailValue"

def test_should_default_details_to_empty_list(self):
result = BreakdownResponse({})
assert len(result.details) == 0
assert result.process is None


if __name__ == "__main__":
Expand Down
Loading