From 331fdc0fcf7ef6bb1e5c87b7bb6515ca3997f028 Mon Sep 17 00:00:00 2001 From: Rupert Swarbrick Date: Tue, 19 May 2026 20:29:08 +0100 Subject: [PATCH] docs: Add documentation to the Result class in testplan.py In particular, this gives types to all the arguments and gives units for the numbers (I had to run some tests to check what they were!) Signed-off-by: Rupert Swarbrick --- src/dvsim/testplan.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/dvsim/testplan.py b/src/dvsim/testplan.py index dee1a95a..8cb25a2d 100644 --- a/src/dvsim/testplan.py +++ b/src/dvsim/testplan.py @@ -16,9 +16,31 @@ class Result: - """The results for a single test.""" + """The results for a job.""" - def __init__(self, name, passing=0, total=0, job_runtime=None, simulated_time=None) -> None: + def __init__( + self, + name: str, + passing: int = 0, + total: int = 0, + job_runtime: float | None = None, + simulated_time: float | None = None, + ) -> None: + """Construct a Result with the given parameters. + + Args: + name: The name of the test. + + passing: The number of runs that passed (possibly different seeds). + + total: The number of runs that happened (will be at least as large as + passing). + + job_runtime: If not None, the number of seconds taken by the job. + + simulated_time: If not None, the simulated time in microseconds. + + """ self.name = name self.passing = passing self.total = total