or the code could handle list/Result values, e.g., something like
@result.setter
def result(self, value: Result | list[Result]):
# First remove all existing results
for entry in self.result:
if any(isinstance(entry, r) for r in POSSIBLE_RESULTS):
self.remove(entry)
values = [value] if isinstance(value, Result) else value
for entry in values:
if any(isinstance(entry, r) for r in POSSIBLE_RESULTS):
self.append(entry)
I am using python 3.11, latest junitparser from pypi.
Pyright complains when I try to set the result property of a TestCase.
I think the type annation of value should be
list[Result]
https://github.com/weiwei/junitparser/blob/d2b7796af4ec12a623487f7f7c0b3c0d72db2404/junitparser/junitparser.py#L367or the code could handle list/Result values, e.g., something like
I am using python 3.11, latest junitparser from pypi.