details:   https://code.tryton.org/tryton/commit/e0ec1da9b057
branch:    default
user:      Cédric Krier <[email protected]>
date:      Tue Oct 21 13:13:23 2025 +0200
description:
        Escape record name used in testing regex
diffstat:

 trytond/trytond/tests/test_field_many2one.py  |  3 ++-
 trytond/trytond/tests/test_field_one2one.py   |  5 ++++-
 trytond/trytond/tests/test_field_reference.py |  4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diffs (63 lines):

diff -r 2970b7a17df8 -r e0ec1da9b057 
trytond/trytond/tests/test_field_many2one.py
--- a/trytond/trytond/tests/test_field_many2one.py      Sat Nov 01 13:04:15 
2025 +0100
+++ b/trytond/trytond/tests/test_field_many2one.py      Tue Oct 21 13:13:23 
2025 +0200
@@ -1,6 +1,7 @@
 # This file is part of Tryton.  The COPYRIGHT file at the top level of
 # this repository contains the full copyright notices and license terms.
 
+import re
 from unittest.mock import patch
 
 from sql import Join, Table
@@ -80,7 +81,7 @@
                 DomainValidationError,
                 'The value "%s" for field "many2one" '
                 'in record ".*" of "Many2One Domain Validation"' %
-                target.rec_name):
+                re.escape(target.rec_name)):
             Many2One.create([{
                         'many2one': target.id,
                         }])
diff -r 2970b7a17df8 -r e0ec1da9b057 trytond/trytond/tests/test_field_one2one.py
--- a/trytond/trytond/tests/test_field_one2one.py       Sat Nov 01 13:04:15 
2025 +0100
+++ b/trytond/trytond/tests/test_field_one2one.py       Tue Oct 21 13:13:23 
2025 +0200
@@ -1,6 +1,8 @@
 # This file is part of Tryton.  The COPYRIGHT file at the top level of
 # this repository contains the full copyright notices and license terms.
 
+import re
+
 from trytond.model.exceptions import (
     DomainValidationError, RequiredValidationError, SQLConstraintError)
 from trytond.pool import Pool
@@ -124,7 +126,8 @@
         with self.assertRaisesRegex(
                 DomainValidationError,
                 'The value "%s" for field "One2One" '
-                'in record ".*" of "One2One Domain"' % target.rec_name):
+                'in record ".*" of "One2One Domain"' %
+                re.escape(target.rec_name)):
             One2One.create([{
                         'one2one': target.id,
                         }])
diff -r 2970b7a17df8 -r e0ec1da9b057 
trytond/trytond/tests/test_field_reference.py
--- a/trytond/trytond/tests/test_field_reference.py     Sat Nov 01 13:04:15 
2025 +0100
+++ b/trytond/trytond/tests/test_field_reference.py     Tue Oct 21 13:13:23 
2025 +0200
@@ -1,6 +1,8 @@
 # This file is part of Tryton.  The COPYRIGHT file at the top level of
 # this repository contains the full copyright notices and license terms.
 
+import re
+
 from trytond.model.exceptions import (
     DomainValidationError, RequiredValidationError)
 from trytond.pool import Pool
@@ -528,7 +530,7 @@
                 DomainValidationError,
                 'The value "%s" for field "Reference" '
                 'in record ".*" of "Reference Domain Validation"' %
-                target.rec_name):
+                re.escape(target.rec_name)):
             reference.save()
 
     @with_transaction()

Reply via email to