Modify wording in docstrings

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
This commit is contained in:
Werner Lewis 2022-08-25 16:27:05 +01:00
parent 3366ebcb66
commit 81f24443b7
2 changed files with 10 additions and 8 deletions

View file

@ -35,7 +35,8 @@ T = TypeVar('T') #pylint: disable=invalid-name
class BaseTarget(metaclass=ABCMeta): class BaseTarget(metaclass=ABCMeta):
"""Base target for test case generation. """Base target for test case generation.
This should be derived from for file Targets. Derive directly from this class when adding new file Targets, setting
`target_basename`.
Attributes: Attributes:
count: Counter for test cases from this class. count: Counter for test cases from this class.
@ -113,7 +114,7 @@ class BaseTarget(metaclass=ABCMeta):
"""Generate test cases for the class and its subclasses. """Generate test cases for the class and its subclasses.
In classes with `test_function` set, `generate_function_tests()` is In classes with `test_function` set, `generate_function_tests()` is
used to generate test cases first. called to generate test cases first.
In all classes, this method will iterate over its subclasses, and In all classes, this method will iterate over its subclasses, and
yield from `generate_tests()` in each. Calling this method on a class X yield from `generate_tests()` in each. Calling this method on a class X

View file

@ -24,7 +24,8 @@ from abstract and concrete classes).
Adding test case generation for a function: Adding test case generation for a function:
A subclass representing the test function should be added, deriving from a A subclass representing the test function should be added, deriving from a
file Target. This test class must set/implement the following: file Target such as BignumTarget. This test class must set/implement the
following:
- test_function: the function name from the associated .function file. - test_function: the function name from the associated .function file.
- test_name: a descriptive name or brief summary to refer to the test - test_name: a descriptive name or brief summary to refer to the test
function. function.
@ -128,8 +129,8 @@ class BignumOperation(BignumTarget, metaclass=ABCMeta):
def result(self) -> str: def result(self) -> str:
"""Get the result of the operation. """Get the result of the operation.
This may be calculated during initialization and stored as `_result`, This could be calculated during initialization and stored as `_result`
or calculated when the method is called. and then returned, or calculated when the method is called.
""" """
raise NotImplementedError raise NotImplementedError
@ -137,8 +138,8 @@ class BignumOperation(BignumTarget, metaclass=ABCMeta):
def value_description(val) -> str: def value_description(val) -> str:
"""Generate a description of the argument val. """Generate a description of the argument val.
This produces a simple description of the value, which are used in test This produces a simple description of the value, which is used in test
case naming, to add context. case naming to add context.
""" """
if val == "": if val == "":
return "0 (null)" return "0 (null)"
@ -231,7 +232,7 @@ class BignumAdd(BignumOperation):
class BignumTestGenerator(test_generation.TestGenerator): class BignumTestGenerator(test_generation.TestGenerator):
"""Test generator subclass setting bignum targets.""" """Test generator subclass, for bignum file Targets."""
TARGETS = { TARGETS = {
subclass.target_basename: subclass.generate_tests for subclass in subclass.target_basename: subclass.generate_tests for subclass in
test_generation.BaseTarget.__subclasses__() test_generation.BaseTarget.__subclasses__()