details:   https://code.tryton.org/tryton/commit/3b490a8531a5
branch:    default
user:      Cédric Krier <[email protected]>
date:      Sat Mar 21 09:22:21 2026 +0100
description:
        Add test to check boolean value for button states

        #14700
diffstat:

 trytond/trytond/tests/test_tryton.py |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (27 lines):

diff -r ffe40330e3f6 -r 3b490a8531a5 trytond/trytond/tests/test_tryton.py
--- a/trytond/trytond/tests/test_tryton.py      Sat Mar 21 09:21:43 2026 +0100
+++ b/trytond/trytond/tests/test_tryton.py      Sat Mar 21 09:22:21 2026 +0100
@@ -36,7 +36,7 @@
 from trytond.modules import parse_module_config
 from trytond.pool import Pool, isregisteredby
 from trytond.protocols.wrappers import Response
-from trytond.pyson import PYSONDecoder, PYSONEncoder
+from trytond.pyson import PYSON, PYSONDecoder, PYSONEncoder
 from trytond.tools import file_open, find_dir, is_instance_method
 from trytond.transaction import Transaction, TransactionError
 from trytond.wizard import StateAction, StateView
@@ -1151,6 +1151,14 @@
                             'model': mname,
                             'keys': set(states) - keys,
                             })
+                    for state in ['readonly', 'invisible']:
+                        if state not in states:
+                            continue
+                        with self.subTest(state=state):
+                            self.assertIsInstance(
+                                states[state], (bool, PYSON))
+                            if hasattr(states[state], 'types'):
+                                self.assertEqual(states[state].types(), {bool})
 
     @with_transaction()
     def test_button_methods(self):

Reply via email to