@@ -150,16 +150,22 @@ def parametrize(argvalues):
150150 Parametrize a test function.
151151
152152 Decorator for upgrade test functions to parametrize and generate multiple tests from
153- it.
153+ it. The new test functions are injected in the containing class. Inspired by the
154+ `parameterized <https://pypi.org/project/parameterized/>`_ package.
154155
155- Usage::
156+ .. example::
157+
158+ .. code-block:: python
156159
157- @parametrize([(1, 2), (2, 4), (-1, -2), (0, 0)])
158- def test_double(self, input, expected):
159- self.assertEqual(input * 2, expected)
160+ @parametrize([(1, 2), (2, 4), (-1, -2), (0, 0)])
161+ def test_double(self, input, expected):
162+ self.assertEqual(input * 2, expected)
160163
161- Works by injecting test functions in the containing class.
162- Inspired by the `parameterized <https://pypi.org/project/parameterized/>`_ package.
164+ This will generate four test methods: ``test_double__0``, ``test_double__1``,
165+ ``test_double__2``, and ``test_double__3``, each with different argument values.
166+
167+ :param list(tuple) argvalues: Arguments for each test case. Each tuple will be
168+ unpacked and passed as arguments to the test function.
163169 """
164170
165171 def make_func (func , name , args ):
@@ -521,7 +527,7 @@ def get_previous_major(major, minor):
521527# pylint: disable=inherit-non-class
522528class UpgradeCase (UpgradeCommon , _create_meta (10 , "upgrade_case" )):
523529 """
524- Test case to verify that the upgrade scripts correctly upgrade data .
530+ Test case to verify the upgrade flow .
525531
526532 Override:
527533
@@ -557,6 +563,7 @@ def check(self, uid): # uid is the value returned by prepare
557563 "SELECT * FROM res_users WHERE id=%s AND NOT active", [uid]
558564 )
559565 self.assertEqual(self.env.cr.rowcount, 1)
566+
560567 """
561568
562569 def __init_subclass__ (cls , abstract = False ):
@@ -572,16 +579,15 @@ def test_prepare(self):
572579# pylint: disable=inherit-non-class
573580class IntegrityCase (UpgradeCommon , _create_meta (20 , "integrity_case" )):
574581 """
575- Test case for validating invariants across upgrades .
582+ Test case for validating upgrade invariants .
576583
577584 Override:
578585
579586 * ``invariant`` to return a JSON-serializable value representing
580587 the invariant to check.
581588
582- The ``invariant`` method is called both before and after the upgrade,
583- and the results are compared.
584-
589+ The ``invariant`` method is called both before and after the upgrade, and the results
590+ are compared. If there is any difference the test fails.
585591
586592 .. example::
587593
0 commit comments