6 | | category ``Foo`` with a subcategory ``Bar``. ``Foo`` wants to |
7 | | provide a method ``Foo.ParentMethods.is_bar`` such that, for ``F`` |
8 | | in ``Foo()``, ``F.is_bar()`` returns whether ``F`` satisfies all |
9 | | the properties of ``Bar()``. The method ``is_bar`` is allowed to |
10 | | assume that ``F`` indeed satisfies all the properties specified by |
11 | | ``Foo()``. It may decide to upgrade the category of ``F`` to |
12 | | ``Bar()``. |
| 6 | category {{{Foo}} with a subcategory {{{Bar}}. {{{Foo}} wants to |
| 7 | provide a method {{{Foo.ParentMethods.is_bar}} such that, for {{{F}} |
| 8 | in {{{Foo()}}, {{{F.is_bar()}} returns whether {{{F}} satisfies all |
| 9 | the properties of {{{Bar()}}. The method {{{is_bar}} is allowed to |
| 10 | assume that {{{F}} indeed satisfies all the properties specified by |
| 11 | {{{Foo()}}. It may decide to upgrade the category of {{{F}} to |
| 12 | {{{Bar()}}. |
14 | | ``Bar`` itself wants to provide a method |
15 | | ``Bar.ParentMethod._test_bar`` which is supposed to do some |
16 | | reasonable sanity checks on ``F`` to determine whether it |
17 | | satisfies all the properties of ``Bar``. If yes, ``F._test_bla()`` |
| 14 | {{{Bar}} itself wants to provide a method |
| 15 | {{{Bar.ParentMethod._test_bar}} which is supposed to do some |
| 16 | reasonable sanity checks on {{{F}} to determine whether it |
| 17 | satisfies all the properties of {{{Bar}}. If yes, {{{F._test_bla()}} |
23 | | The purpose of two decorators ``is_method`` and |
24 | | ``_test_method_from_is`` is to factor out the logic between the two |
25 | | related methods ``F.is_bla()`` and ``F._test_bla()``. They take as |
26 | | input a Python function ``is_bla(self, proof=False, **options)``. |
27 | | This function should proceed as usual for a ``_test method`` (see |
28 | | :class:`TestSuite`). If ``proof`` is ``True``, then the answer |
29 | | should be provably correct. At the end, ``is_bla`` should return |
30 | | ``None``, or a category that will be used to refine the category |
31 | | of ``F``. |
| 23 | The purpose of two decorators {{{is_method}} and |
| 24 | {{{_test_method_from_is}} is to factor out the logic between the two |
| 25 | related methods {{{F.is_bla()}} and {{{F._test_bla()}}. They take as |
| 26 | input a Python function {{{is_bla(self, proof=False, **options)}}. |
| 27 | This function should proceed as usual for a {{{_test method}} (see |
| 28 | :class:`TestSuite`). If {{{proof}} is {{{True}}, then the answer |
| 29 | should be provably correct. At the end, {{{is_bla}} should return |
| 30 | {{{None}}, or a category that will be used to refine the category |
| 31 | of {{{F}}. |