From ce070af2fa8cb5aca65a61964f239ab42775e771 Mon Sep 17 00:00:00 2001
From: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Date: Mon, 9 Dec 2024 15:10:18 +0000
Subject: [PATCH] Avoid using camelCase names in domain tests
---
tests/test_domains/test_domain_c.py | 308 ++++++++---------
tests/test_domains/test_domain_cpp.py | 454 +++++++++++++-------------
tests/test_domains/test_domain_std.py | 4 +-
3 files changed, 383 insertions(+), 383 deletions(-)
diff --git a/tests/test_domains/test_domain_c.py b/tests/test_domains/test_domain_c.py
index 339938010..cd06a5e09 100644
--- a/tests/test_domains/test_domain_c.py
+++ b/tests/test_domains/test_domain_c.py
@@ -49,62 +49,62 @@ def parse(name, string):
return ast
-def _check(name, input, idDict, output, key, asTextOutput):
+def _check(name, input, id_dict, output, key, as_text_output):
if key is None:
key = name
key += ' '
if name in {'function', 'member'}:
- inputActual = input
- outputAst = output
- outputAsText = output
+ input_actual = input
+ output_ast = output
+ output_as_text = output
else:
- inputActual = input.format(key='')
- outputAst = output.format(key='')
- outputAsText = output.format(key=key)
- if asTextOutput is not None:
- outputAsText = asTextOutput
+ input_actual = input.format(key='')
+ output_ast = output.format(key='')
+ output_as_text = output.format(key=key)
+ if as_text_output is not None:
+ output_as_text = as_text_output
# first a simple check of the AST
- ast = parse(name, inputActual)
+ ast = parse(name, input_actual)
res = str(ast)
- if res != outputAst:
+ if res != output_ast:
print()
print('Input: ', input)
print('Result: ', res)
- print('Expected: ', outputAst)
+ print('Expected: ', output_ast)
raise DefinitionError
- rootSymbol = Symbol(None, None, None, None, None)
- symbol = rootSymbol.add_declaration(ast, docname='TestDoc', line=42)
- parentNode = addnodes.desc()
+ root_symbol = Symbol(None, None, None, None, None)
+ symbol = root_symbol.add_declaration(ast, docname='TestDoc', line=42)
+ parent_node = addnodes.desc()
signode = addnodes.desc_signature(input, '')
- parentNode += signode
+ parent_node += signode
ast.describe_signature(signode, 'lastIsName', symbol, options={})
- resAsText = parentNode.astext()
- if resAsText != outputAsText:
+ res_as_text = parent_node.astext()
+ if res_as_text != output_as_text:
print()
print('Input: ', input)
- print('astext(): ', resAsText)
- print('Expected: ', outputAsText)
+ print('astext(): ', res_as_text)
+ print('Expected: ', output_as_text)
raise DefinitionError
- idExpected = [None]
+ id_expected = [None]
for i in range(1, _max_id + 1):
- if i in idDict:
- idExpected.append(idDict[i])
+ if i in id_dict:
+ id_expected.append(id_dict[i])
else:
- idExpected.append(idExpected[i - 1])
- idActual = [None]
+ id_expected.append(id_expected[i - 1])
+ id_actual = [None]
for i in range(1, _max_id + 1):
# try:
id = ast.get_id(version=i)
assert id is not None
- idActual.append(id[len(_id_prefix[i]) :])
+ id_actual.append(id[len(_id_prefix[i]) :])
# except NoOldIdError:
- # idActual.append(None)
+ # id_actual.append(None)
res = [True]
for i in range(1, _max_id + 1):
- res.append(idExpected[i] == idActual[i])
+ res.append(id_expected[i] == id_actual[i])
if not all(res):
print('input: %s' % input.rjust(20))
@@ -112,31 +112,31 @@ def _check(name, input, idDict, output, key, asTextOutput):
if res[i]:
continue
print('Error in id version %d.' % i)
- print('result: %s' % idActual[i])
- print('expected: %s' % idExpected[i])
- # print(rootSymbol.dump(0))
+ print('result: %s' % id_actual[i])
+ print('expected: %s' % id_expected[i])
+ # print(root_symbol.dump(0))
raise DefinitionError
-def check(name, input, idDict, output=None, key=None, asTextOutput=None):
+def check(name, input, id_dict, output=None, key=None, as_text_output=None):
if output is None:
output = input
# First, check without semicolon
- _check(name, input, idDict, output, key, asTextOutput)
+ _check(name, input, id_dict, output, key, as_text_output)
if name != 'macro':
# Second, check with semicolon
_check(
name,
input + ' ;',
- idDict,
+ id_dict,
output + ';',
key,
- asTextOutput + ';' if asTextOutput is not None else None,
+ as_text_output + ';' if as_text_output is not None else None,
)
def test_domain_c_ast_expressions():
- def exprCheck(expr, output=None):
+ def expr_check(expr, output=None):
parser = DefinitionParser(expr, location=None, config=Config())
parser.allowFallbackExpressionParsing = False
ast = parser.parse_expression()
@@ -151,30 +151,30 @@ def test_domain_c_ast_expressions():
print('Result: ', res)
print('Expected: ', output)
raise DefinitionError
- displayString = ast.get_display_string()
- if res != displayString:
+ display_string = ast.get_display_string()
+ if res != display_string:
# note: if the expression contains an anon name then this will trigger a falsely
print()
print('Input: ', expr)
print('Result: ', res)
- print('Display: ', displayString)
+ print('Display: ', display_string)
raise DefinitionError
# type expressions
- exprCheck('int*')
- exprCheck('int *const*')
- exprCheck('int *volatile*')
- exprCheck('int *restrict*')
- exprCheck('int *(*)(double)')
- exprCheck('const int*')
- exprCheck('__int64')
- exprCheck('unsigned __int64')
+ expr_check('int*')
+ expr_check('int *const*')
+ expr_check('int *volatile*')
+ expr_check('int *restrict*')
+ expr_check('int *(*)(double)')
+ expr_check('const int*')
+ expr_check('__int64')
+ expr_check('unsigned __int64')
# actual expressions
# primary
- exprCheck('true')
- exprCheck('false')
+ expr_check('true')
+ expr_check('false')
ints = [
'5',
'0',
@@ -188,15 +188,15 @@ def test_domain_c_ast_expressions():
"0x0'1'2",
"1'2'3",
]
- unsignedSuffix = ['', 'u', 'U']
- longSuffix = ['', 'l', 'L', 'll', 'LL']
+ unsigned_suffix = ['', 'u', 'U']
+ long_suffix = ['', 'l', 'L', 'll', 'LL']
for i in ints:
- for u in unsignedSuffix:
- for l in longSuffix:
+ for u in unsigned_suffix:
+ for l in long_suffix:
expr = i + u + l
- exprCheck(expr)
+ expr_check(expr)
expr = i + l + u
- exprCheck(expr)
+ expr_check(expr)
for suffix in ('', 'f', 'F', 'l', 'L'):
for e in (
'5e42',
@@ -220,7 +220,7 @@ def test_domain_c_ast_expressions():
"1'2'3.4'5'6e7'8'9",
):
expr = e + suffix
- exprCheck(expr)
+ expr_check(expr)
for e in (
'ApF',
'Ap+F',
@@ -243,94 +243,94 @@ def test_domain_c_ast_expressions():
"A'B'C.D'E'Fp1'2'3",
):
expr = '0x' + e + suffix
- exprCheck(expr)
- exprCheck('"abc\\"cba"') # string
+ expr_check(expr)
+ expr_check('"abc\\"cba"') # string
# character literals
for p in ('', 'u8', 'u', 'U', 'L'):
- exprCheck(p + "'a'")
- exprCheck(p + "'\\n'")
- exprCheck(p + "'\\012'")
- exprCheck(p + "'\\0'")
- exprCheck(p + "'\\x0a'")
- exprCheck(p + "'\\x0A'")
- exprCheck(p + "'\\u0a42'")
- exprCheck(p + "'\\u0A42'")
- exprCheck(p + "'\\U0001f34c'")
- exprCheck(p + "'\\U0001F34C'")
+ expr_check(p + "'a'")
+ expr_check(p + "'\\n'")
+ expr_check(p + "'\\012'")
+ expr_check(p + "'\\0'")
+ expr_check(p + "'\\x0a'")
+ expr_check(p + "'\\x0A'")
+ expr_check(p + "'\\u0a42'")
+ expr_check(p + "'\\u0A42'")
+ expr_check(p + "'\\U0001f34c'")
+ expr_check(p + "'\\U0001F34C'")
- exprCheck('(5)')
- exprCheck('C')
+ expr_check('(5)')
+ expr_check('C')
# postfix
- exprCheck('A(2)')
- exprCheck('A[2]')
- exprCheck('a.b.c')
- exprCheck('a->b->c')
- exprCheck('i++')
- exprCheck('i--')
+ expr_check('A(2)')
+ expr_check('A[2]')
+ expr_check('a.b.c')
+ expr_check('a->b->c')
+ expr_check('i++')
+ expr_check('i--')
# unary
- exprCheck('++5')
- exprCheck('--5')
- exprCheck('*5')
- exprCheck('&5')
- exprCheck('+5')
- exprCheck('-5')
- exprCheck('!5')
- exprCheck('not 5')
- exprCheck('~5')
- exprCheck('compl 5')
- exprCheck('sizeof(T)')
- exprCheck('sizeof -42')
- exprCheck('alignof(T)')
+ expr_check('++5')
+ expr_check('--5')
+ expr_check('*5')
+ expr_check('&5')
+ expr_check('+5')
+ expr_check('-5')
+ expr_check('!5')
+ expr_check('not 5')
+ expr_check('~5')
+ expr_check('compl 5')
+ expr_check('sizeof(T)')
+ expr_check('sizeof -42')
+ expr_check('alignof(T)')
# cast
- exprCheck('(int)2')
+ expr_check('(int)2')
# binary op
- exprCheck('5 || 42')
- exprCheck('5 or 42')
- exprCheck('5 && 42')
- exprCheck('5 and 42')
- exprCheck('5 | 42')
- exprCheck('5 bitor 42')
- exprCheck('5 ^ 42')
- exprCheck('5 xor 42')
- exprCheck('5 & 42')
- exprCheck('5 bitand 42')
+ expr_check('5 || 42')
+ expr_check('5 or 42')
+ expr_check('5 && 42')
+ expr_check('5 and 42')
+ expr_check('5 | 42')
+ expr_check('5 bitor 42')
+ expr_check('5 ^ 42')
+ expr_check('5 xor 42')
+ expr_check('5 & 42')
+ expr_check('5 bitand 42')
# ['==', '!=']
- exprCheck('5 == 42')
- exprCheck('5 != 42')
- exprCheck('5 not_eq 42')
+ expr_check('5 == 42')
+ expr_check('5 != 42')
+ expr_check('5 not_eq 42')
# ['<=', '>=', '<', '>']
- exprCheck('5 <= 42')
- exprCheck('5 >= 42')
- exprCheck('5 < 42')
- exprCheck('5 > 42')
+ expr_check('5 <= 42')
+ expr_check('5 >= 42')
+ expr_check('5 < 42')
+ expr_check('5 > 42')
# ['<<', '>>']
- exprCheck('5 << 42')
- exprCheck('5 >> 42')
+ expr_check('5 << 42')
+ expr_check('5 >> 42')
# ['+', '-']
- exprCheck('5 + 42')
- exprCheck('5 - 42')
+ expr_check('5 + 42')
+ expr_check('5 - 42')
# ['*', '/', '%']
- exprCheck('5 * 42')
- exprCheck('5 / 42')
- exprCheck('5 % 42')
+ expr_check('5 * 42')
+ expr_check('5 / 42')
+ expr_check('5 % 42')
# ['.*', '->*']
# conditional
# TODO
# assignment
- exprCheck('a = 5')
- exprCheck('a *= 5')
- exprCheck('a /= 5')
- exprCheck('a %= 5')
- exprCheck('a += 5')
- exprCheck('a -= 5')
- exprCheck('a >>= 5')
- exprCheck('a <<= 5')
- exprCheck('a &= 5')
- exprCheck('a and_eq 5')
- exprCheck('a ^= 5')
- exprCheck('a xor_eq 5')
- exprCheck('a |= 5')
- exprCheck('a or_eq 5')
+ expr_check('a = 5')
+ expr_check('a *= 5')
+ expr_check('a /= 5')
+ expr_check('a %= 5')
+ expr_check('a += 5')
+ expr_check('a -= 5')
+ expr_check('a >>= 5')
+ expr_check('a <<= 5')
+ expr_check('a &= 5')
+ expr_check('a and_eq 5')
+ expr_check('a ^= 5')
+ expr_check('a xor_eq 5')
+ expr_check('a |= 5')
+ expr_check('a or_eq 5')
def test_domain_c_ast_fundamental_types():
@@ -588,29 +588,29 @@ def test_domain_c_ast_enum_definitions():
def test_domain_c_ast_anon_definitions():
- check('struct', '@a', {1: '@a'}, asTextOutput='struct [anonymous]')
- check('union', '@a', {1: '@a'}, asTextOutput='union [anonymous]')
- check('enum', '@a', {1: '@a'}, asTextOutput='enum [anonymous]')
- check('struct', '@1', {1: '@1'}, asTextOutput='struct [anonymous]')
- check('struct', '@a.A', {1: '@a.A'}, asTextOutput='struct [anonymous].A')
+ check('struct', '@a', {1: '@a'}, as_text_output='struct [anonymous]')
+ check('union', '@a', {1: '@a'}, as_text_output='union [anonymous]')
+ check('enum', '@a', {1: '@a'}, as_text_output='enum [anonymous]')
+ check('struct', '@1', {1: '@1'}, as_text_output='struct [anonymous]')
+ check('struct', '@a.A', {1: '@a.A'}, as_text_output='struct [anonymous].A')
def test_domain_c_ast_initializers():
- idsMember = {1: 'v'}
- idsFunction = {1: 'f'}
+ ids_member = {1: 'v'}
+ ids_function = {1: 'f'}
# no init
- check('member', 'T v', idsMember)
- check('function', 'void f(T v)', idsFunction)
+ check('member', 'T v', ids_member)
+ check('function', 'void f(T v)', ids_function)
# with '=', assignment-expression
- check('member', 'T v = 42', idsMember)
- check('function', 'void f(T v = 42)', idsFunction)
+ check('member', 'T v = 42', ids_member)
+ check('function', 'void f(T v = 42)', ids_function)
# with '=', braced-init
- check('member', 'T v = {}', idsMember)
- check('function', 'void f(T v = {})', idsFunction)
- check('member', 'T v = {42, 42, 42}', idsMember)
- check('function', 'void f(T v = {42, 42, 42})', idsFunction)
- check('member', 'T v = {42, 42, 42,}', idsMember)
- check('function', 'void f(T v = {42, 42, 42,})', idsFunction)
+ check('member', 'T v = {}', ids_member)
+ check('function', 'void f(T v = {})', ids_function)
+ check('member', 'T v = {42, 42, 42}', ids_member)
+ check('function', 'void f(T v = {42, 42, 42})', ids_function)
+ check('member', 'T v = {42, 42, 42,}', ids_member)
+ check('function', 'void f(T v = {42, 42, 42,})', ids_function)
# TODO: designator-list
@@ -723,9 +723,9 @@ def extract_role_links(app, filename):
entries = []
for l in lis:
li = ET.fromstring(l) # NoQA: S314 # using known data in tests
- aList = list(li.iter('a'))
- assert len(aList) == 1
- a = aList[0]
+ a_list = list(li.iter('a'))
+ assert len(a_list) == 1
+ a = a_list[0]
target = a.attrib['href'].lstrip('#')
title = a.attrib['title']
assert len(a) == 1
@@ -808,12 +808,12 @@ def test_domain_c_build_field_role(app):
assert len(ws) == 0
-def _get_obj(app, queryName):
+def _get_obj(app, query_name):
domain = app.env.domains.c_domain
- for name, _dispname, objectType, docname, anchor, _prio in domain.get_objects():
- if name == queryName:
- return docname, anchor, objectType
- return queryName, 'not', 'found'
+ for name, _dispname, object_type, docname, anchor, _prio in domain.get_objects():
+ if name == query_name:
+ return docname, anchor, object_type
+ return query_name, 'not', 'found'
@pytest.mark.sphinx(
@@ -822,7 +822,7 @@ def _get_obj(app, queryName):
def test_domain_c_build_intersphinx(tmp_path, app):
# a splitting of test_ids_vs_tags0 into the primary directives in a remote project,
# and then the references in the test project
- origSource = """\
+ orig_source = """\
.. c:member:: int _member
.. c:var:: int _var
.. c:function:: void _function()
diff --git a/tests/test_domains/test_domain_cpp.py b/tests/test_domains/test_domain_cpp.py
index 96208bf74..8e56cd530 100644
--- a/tests/test_domains/test_domain_cpp.py
+++ b/tests/test_domains/test_domain_cpp.py
@@ -51,63 +51,63 @@ def parse(name, string):
return ast
-def _check(name, input, idDict, output, key, asTextOutput):
+def _check(name, input, id_dict, output, key, as_text_output):
if key is None:
key = name
key += ' '
if name in {'function', 'member'}:
- inputActual = input
- outputAst = output
- outputAsText = output
+ input_actual = input
+ output_ast = output
+ output_as_text = output
else:
- inputActual = input.format(key='')
- outputAst = output.format(key='')
- outputAsText = output.format(key=key)
- if asTextOutput is not None:
- outputAsText = asTextOutput
+ input_actual = input.format(key='')
+ output_ast = output.format(key='')
+ output_as_text = output.format(key=key)
+ if as_text_output is not None:
+ output_as_text = as_text_output
# first a simple check of the AST
- ast = parse(name, inputActual)
+ ast = parse(name, input_actual)
res = str(ast)
- if res != outputAst:
+ if res != output_ast:
print()
print('Input: ', input)
print('Result: ', res)
- print('Expected: ', outputAst)
+ print('Expected: ', output_ast)
raise DefinitionError
- rootSymbol = Symbol(None, None, None, None, None, None, None)
- symbol = rootSymbol.add_declaration(ast, docname='TestDoc', line=42)
- parentNode = addnodes.desc()
+ root_symbol = Symbol(None, None, None, None, None, None, None)
+ symbol = root_symbol.add_declaration(ast, docname='TestDoc', line=42)
+ parent_node = addnodes.desc()
signode = addnodes.desc_signature(input, '')
- parentNode += signode
+ parent_node += signode
ast.describe_signature(signode, 'lastIsName', symbol, options={})
- resAsText = parentNode.astext()
- if resAsText != outputAsText:
+ res_as_text = parent_node.astext()
+ if res_as_text != output_as_text:
print()
print('Input: ', input)
- print('astext(): ', resAsText)
- print('Expected: ', outputAsText)
- print('Node:', parentNode)
+ print('astext(): ', res_as_text)
+ print('Expected: ', output_as_text)
+ print('Node:', parent_node)
raise DefinitionError
- idExpected = [None]
+ id_expected = [None]
for i in range(1, _max_id + 1):
- if i in idDict:
- idExpected.append(idDict[i])
+ if i in id_dict:
+ id_expected.append(id_dict[i])
else:
- idExpected.append(idExpected[i - 1])
- idActual = [None]
+ id_expected.append(id_expected[i - 1])
+ id_actual = [None]
for i in range(1, _max_id + 1):
try:
id = ast.get_id(version=i)
assert id is not None
- idActual.append(id[len(_id_prefix[i]) :])
+ id_actual.append(id[len(_id_prefix[i]) :])
except NoOldIdError:
- idActual.append(None)
+ id_actual.append(None)
res = [True]
for i in range(1, _max_id + 1):
- res.append(idExpected[i] == idActual[i])
+ res.append(id_expected[i] == id_actual[i])
if not all(res):
print('input: %s' % input.rjust(20))
@@ -115,25 +115,25 @@ def _check(name, input, idDict, output, key, asTextOutput):
if res[i]:
continue
print('Error in id version %d.' % i)
- print('result: %s' % idActual[i])
- print('expected: %s' % idExpected[i])
- print(rootSymbol.dump(0))
+ print('result: %s' % id_actual[i])
+ print('expected: %s' % id_expected[i])
+ print(root_symbol.dump(0))
raise DefinitionError
-def check(name, input, idDict, output=None, key=None, asTextOutput=None):
+def check(name, input, id_dict, output=None, key=None, as_text_output=None):
if output is None:
output = input
# First, check without semicolon
- _check(name, input, idDict, output, key, asTextOutput)
+ _check(name, input, id_dict, output, key, as_text_output)
# Second, check with semicolon
_check(
name,
input + ' ;',
- idDict,
+ id_dict,
output + ';',
key,
- asTextOutput + ';' if asTextOutput is not None else None,
+ as_text_output + ';' if as_text_output is not None else None,
)
@@ -177,13 +177,13 @@ def test_domain_cpp_ast_fundamental_types(type_, id_v2):
def test_domain_cpp_ast_expressions():
- def exprCheck(expr, id, id4=None):
+ def expr_check(expr, id, id4=None):
ids = 'IE1CIA%s_1aE'
# call .format() on the expr to unescape double curly braces
- idDict = {2: ids % expr.format(), 3: ids % id}
+ id_dict = {2: ids % expr.format(), 3: ids % id}
if id4 is not None:
- idDict[4] = ids % id4
- check('class', 'template<> {key}C' % expr, idDict)
+ id_dict[4] = ids % id4
+ check('class', 'template<> {key}C' % expr, id_dict)
class Config:
cpp_id_attributes = ['id_attr']
@@ -198,19 +198,19 @@ def test_domain_cpp_ast_expressions():
print('Input: ', expr)
print('Result: ', res)
raise DefinitionError
- displayString = ast.get_display_string()
- if res != displayString:
+ display_string = ast.get_display_string()
+ if res != display_string:
# note: if the expression contains an anon name then this will trigger a falsely
print()
print('Input: ', expr)
print('Result: ', res)
- print('Display: ', displayString)
+ print('Display: ', display_string)
raise DefinitionError
# primary
- exprCheck('nullptr', 'LDnE')
- exprCheck('true', 'L1E')
- exprCheck('false', 'L0E')
+ expr_check('nullptr', 'LDnE')
+ expr_check('true', 'L1E')
+ expr_check('false', 'L0E')
ints = [
'5',
'0',
@@ -224,16 +224,16 @@ def test_domain_cpp_ast_expressions():
"0x0'1'2",
"1'2'3",
]
- unsignedSuffix = ['', 'u', 'U']
- longSuffix = ['', 'l', 'L', 'll', 'LL']
+ unsigned_suffix = ['', 'u', 'U']
+ long_suffix = ['', 'l', 'L', 'll', 'LL']
for i in ints:
- for u in unsignedSuffix:
- for l in longSuffix:
+ for u in unsigned_suffix:
+ for l in long_suffix:
expr = i + u + l
- exprCheck(expr, 'L' + expr.replace("'", '') + 'E')
+ expr_check(expr, 'L' + expr.replace("'", '') + 'E')
expr = i + l + u
- exprCheck(expr, 'L' + expr.replace("'", '') + 'E')
- decimalFloats = [
+ expr_check(expr, 'L' + expr.replace("'", '') + 'E')
+ decimal_floats = [
'5e42',
'5e+42',
'5e-42',
@@ -254,7 +254,7 @@ def test_domain_cpp_ast_expressions():
".4'5'6e7'8'9",
"1'2'3.4'5'6e7'8'9",
]
- hexFloats = [
+ hex_floats = [
'ApF',
'Ap+F',
'Ap-F',
@@ -276,16 +276,16 @@ def test_domain_cpp_ast_expressions():
"A'B'C.D'E'Fp1'2'3",
]
for suffix in ('', 'f', 'F', 'l', 'L'):
- for e in decimalFloats:
+ for e in decimal_floats:
expr = e + suffix
- exprCheck(expr, 'L' + expr.replace("'", '') + 'E')
- for e in hexFloats:
+ expr_check(expr, 'L' + expr.replace("'", '') + 'E')
+ for e in hex_floats:
expr = '0x' + e + suffix
- exprCheck(expr, 'L' + expr.replace("'", '') + 'E')
- exprCheck('"abc\\"cba"', 'LA8_KcE') # string
- exprCheck('this', 'fpT')
+ expr_check(expr, 'L' + expr.replace("'", '') + 'E')
+ expr_check('"abc\\"cba"', 'LA8_KcE') # string
+ expr_check('this', 'fpT')
# character literals
- charPrefixAndIds = [('', 'c'), ('u8', 'c'), ('u', 'Ds'), ('U', 'Di'), ('L', 'w')]
+ char_prefix_and_ids = [('', 'c'), ('u8', 'c'), ('u', 'Ds'), ('U', 'Di'), ('L', 'w')]
chars = [
('a', '97'),
('\\n', '10'),
@@ -298,156 +298,156 @@ def test_domain_cpp_ast_expressions():
('\\U0001f34c', '127820'),
('\\U0001F34C', '127820'),
]
- for p, t in charPrefixAndIds:
+ for p, t in char_prefix_and_ids:
for c, val in chars:
- exprCheck(f"{p}'{c}'", t + val)
+ expr_check(f"{p}'{c}'", t + val)
# user-defined literals
for i in ints:
- exprCheck(i + '_udl', 'clL_Zli4_udlEL' + i.replace("'", '') + 'EE')
- exprCheck(i + 'uludl', 'clL_Zli5uludlEL' + i.replace("'", '') + 'EE')
- for f in decimalFloats:
- exprCheck(f + '_udl', 'clL_Zli4_udlEL' + f.replace("'", '') + 'EE')
- exprCheck(f + 'fudl', 'clL_Zli4fudlEL' + f.replace("'", '') + 'EE')
- for f in hexFloats:
- exprCheck('0x' + f + '_udl', 'clL_Zli4_udlEL0x' + f.replace("'", '') + 'EE')
- for p, t in charPrefixAndIds:
+ expr_check(i + '_udl', 'clL_Zli4_udlEL' + i.replace("'", '') + 'EE')
+ expr_check(i + 'uludl', 'clL_Zli5uludlEL' + i.replace("'", '') + 'EE')
+ for f in decimal_floats:
+ expr_check(f + '_udl', 'clL_Zli4_udlEL' + f.replace("'", '') + 'EE')
+ expr_check(f + 'fudl', 'clL_Zli4fudlEL' + f.replace("'", '') + 'EE')
+ for f in hex_floats:
+ expr_check('0x' + f + '_udl', 'clL_Zli4_udlEL0x' + f.replace("'", '') + 'EE')
+ for p, t in char_prefix_and_ids:
for c, val in chars:
- exprCheck(f"{p}'{c}'_udl", 'clL_Zli4_udlE' + t + val + 'E')
- exprCheck('"abc"_udl', 'clL_Zli4_udlELA3_KcEE')
+ expr_check(f"{p}'{c}'_udl", 'clL_Zli4_udlE' + t + val + 'E')
+ expr_check('"abc"_udl', 'clL_Zli4_udlELA3_KcEE')
# from issue #7294
- exprCheck('6.62607015e-34q_J', 'clL_Zli3q_JEL6.62607015e-34EE')
+ expr_check('6.62607015e-34q_J', 'clL_Zli3q_JEL6.62607015e-34EE')
# fold expressions, paren, name
- exprCheck('(... + Ns)', '(... + Ns)', id4='flpl2Ns')
- exprCheck('(Ns + ...)', '(Ns + ...)', id4='frpl2Ns')
- exprCheck('(Ns + ... + 0)', '(Ns + ... + 0)', id4='fLpl2NsL0E')
- exprCheck('(5)', 'L5E')
- exprCheck('C', '1C')
+ expr_check('(... + Ns)', '(... + Ns)', id4='flpl2Ns')
+ expr_check('(Ns + ...)', '(Ns + ...)', id4='frpl2Ns')
+ expr_check('(Ns + ... + 0)', '(Ns + ... + 0)', id4='fLpl2NsL0E')
+ expr_check('(5)', 'L5E')
+ expr_check('C', '1C')
# postfix
- exprCheck('A(2)', 'cl1AL2EE')
- exprCheck('A[2]', 'ix1AL2E')
- exprCheck('a.b.c', 'dtdt1a1b1c')
- exprCheck('a->b->c', 'ptpt1a1b1c')
- exprCheck('i++', 'pp1i')
- exprCheck('i--', 'mm1i')
- exprCheck('dynamic_cast(i)++', 'ppdcR1T1i')
- exprCheck('static_cast(i)++', 'ppscR1T1i')
- exprCheck('reinterpret_cast(i)++', 'pprcR1T1i')
- exprCheck('const_cast(i)++', 'ppccR1T1i')
- exprCheck('typeid(T).name', 'dtti1T4name')
- exprCheck('typeid(a + b).name', 'dttepl1a1b4name')
+ expr_check('A(2)', 'cl1AL2EE')
+ expr_check('A[2]', 'ix1AL2E')
+ expr_check('a.b.c', 'dtdt1a1b1c')
+ expr_check('a->b->c', 'ptpt1a1b1c')
+ expr_check('i++', 'pp1i')
+ expr_check('i--', 'mm1i')
+ expr_check('dynamic_cast(i)++', 'ppdcR1T1i')
+ expr_check('static_cast(i)++', 'ppscR1T1i')
+ expr_check('reinterpret_cast(i)++', 'pprcR1T1i')
+ expr_check('const_cast(i)++', 'ppccR1T1i')
+ expr_check('typeid(T).name', 'dtti1T4name')
+ expr_check('typeid(a + b).name', 'dttepl1a1b4name')
# unary
- exprCheck('++5', 'pp_L5E')
- exprCheck('--5', 'mm_L5E')
- exprCheck('*5', 'deL5E')
- exprCheck('&5', 'adL5E')
- exprCheck('+5', 'psL5E')
- exprCheck('-5', 'ngL5E')
- exprCheck('!5', 'ntL5E')
- exprCheck('not 5', 'ntL5E')
- exprCheck('~5', 'coL5E')
- exprCheck('compl 5', 'coL5E')
- exprCheck('sizeof...(a)', 'sZ1a')
- exprCheck('sizeof(T)', 'st1T')
- exprCheck('sizeof -42', 'szngL42E')
- exprCheck('alignof(T)', 'at1T')
- exprCheck('noexcept(-42)', 'nxngL42E')
+ expr_check('++5', 'pp_L5E')
+ expr_check('--5', 'mm_L5E')
+ expr_check('*5', 'deL5E')
+ expr_check('&5', 'adL5E')
+ expr_check('+5', 'psL5E')
+ expr_check('-5', 'ngL5E')
+ expr_check('!5', 'ntL5E')
+ expr_check('not 5', 'ntL5E')
+ expr_check('~5', 'coL5E')
+ expr_check('compl 5', 'coL5E')
+ expr_check('sizeof...(a)', 'sZ1a')
+ expr_check('sizeof(T)', 'st1T')
+ expr_check('sizeof -42', 'szngL42E')
+ expr_check('alignof(T)', 'at1T')
+ expr_check('noexcept(-42)', 'nxngL42E')
# new-expression
- exprCheck('new int', 'nw_iE')
- exprCheck('new volatile int', 'nw_ViE')
- exprCheck('new int[42]', 'nw_AL42E_iE')
- exprCheck('new int()', 'nw_ipiE')
- exprCheck('new int(5, 42)', 'nw_ipiL5EL42EE')
- exprCheck('::new int', 'nw_iE')
- exprCheck('new int{{}}', 'nw_iilE')
- exprCheck('new int{{5, 42}}', 'nw_iilL5EL42EE')
+ expr_check('new int', 'nw_iE')
+ expr_check('new volatile int', 'nw_ViE')
+ expr_check('new int[42]', 'nw_AL42E_iE')
+ expr_check('new int()', 'nw_ipiE')
+ expr_check('new int(5, 42)', 'nw_ipiL5EL42EE')
+ expr_check('::new int', 'nw_iE')
+ expr_check('new int{{}}', 'nw_iilE')
+ expr_check('new int{{5, 42}}', 'nw_iilL5EL42EE')
# delete-expression
- exprCheck('delete p', 'dl1p')
- exprCheck('delete [] p', 'da1p')
- exprCheck('::delete p', 'dl1p')
- exprCheck('::delete [] p', 'da1p')
+ expr_check('delete p', 'dl1p')
+ expr_check('delete [] p', 'da1p')
+ expr_check('::delete p', 'dl1p')
+ expr_check('::delete [] p', 'da1p')
# cast
- exprCheck('(int)2', 'cviL2E')
+ expr_check('(int)2', 'cviL2E')
# binary op
- exprCheck('5 || 42', 'ooL5EL42E')
- exprCheck('5 or 42', 'ooL5EL42E')
- exprCheck('5 && 42', 'aaL5EL42E')
- exprCheck('5 and 42', 'aaL5EL42E')
- exprCheck('5 | 42', 'orL5EL42E')
- exprCheck('5 bitor 42', 'orL5EL42E')
- exprCheck('5 ^ 42', 'eoL5EL42E')
- exprCheck('5 xor 42', 'eoL5EL42E')
- exprCheck('5 & 42', 'anL5EL42E')
- exprCheck('5 bitand 42', 'anL5EL42E')
+ expr_check('5 || 42', 'ooL5EL42E')
+ expr_check('5 or 42', 'ooL5EL42E')
+ expr_check('5 && 42', 'aaL5EL42E')
+ expr_check('5 and 42', 'aaL5EL42E')
+ expr_check('5 | 42', 'orL5EL42E')
+ expr_check('5 bitor 42', 'orL5EL42E')
+ expr_check('5 ^ 42', 'eoL5EL42E')
+ expr_check('5 xor 42', 'eoL5EL42E')
+ expr_check('5 & 42', 'anL5EL42E')
+ expr_check('5 bitand 42', 'anL5EL42E')
# ['==', '!=']
- exprCheck('5 == 42', 'eqL5EL42E')
- exprCheck('5 != 42', 'neL5EL42E')
- exprCheck('5 not_eq 42', 'neL5EL42E')
+ expr_check('5 == 42', 'eqL5EL42E')
+ expr_check('5 != 42', 'neL5EL42E')
+ expr_check('5 not_eq 42', 'neL5EL42E')
# ['<=', '>=', '<', '>', '<=>']
- exprCheck('5 <= 42', 'leL5EL42E')
- exprCheck('A <= 42', 'le1AL42E')
- exprCheck('5 >= 42', 'geL5EL42E')
- exprCheck('5 < 42', 'ltL5EL42E')
- exprCheck('A < 42', 'lt1AL42E')
- exprCheck('5 > 42', 'gtL5EL42E')
- exprCheck('A > 42', 'gt1AL42E')
- exprCheck('5 <=> 42', 'ssL5EL42E')
- exprCheck('A <=> 42', 'ss1AL42E')
+ expr_check('5 <= 42', 'leL5EL42E')
+ expr_check('A <= 42', 'le1AL42E')
+ expr_check('5 >= 42', 'geL5EL42E')
+ expr_check('5 < 42', 'ltL5EL42E')
+ expr_check('A < 42', 'lt1AL42E')
+ expr_check('5 > 42', 'gtL5EL42E')
+ expr_check('A > 42', 'gt1AL42E')
+ expr_check('5 <=> 42', 'ssL5EL42E')
+ expr_check('A <=> 42', 'ss1AL42E')
# ['<<', '>>']
- exprCheck('5 << 42', 'lsL5EL42E')
- exprCheck('A << 42', 'ls1AL42E')
- exprCheck('5 >> 42', 'rsL5EL42E')
+ expr_check('5 << 42', 'lsL5EL42E')
+ expr_check('A << 42', 'ls1AL42E')
+ expr_check('5 >> 42', 'rsL5EL42E')
# ['+', '-']
- exprCheck('5 + 42', 'plL5EL42E')
- exprCheck('5 - 42', 'miL5EL42E')
+ expr_check('5 + 42', 'plL5EL42E')
+ expr_check('5 - 42', 'miL5EL42E')
# ['*', '/', '%']
- exprCheck('5 * 42', 'mlL5EL42E')
- exprCheck('5 / 42', 'dvL5EL42E')
- exprCheck('5 % 42', 'rmL5EL42E')
+ expr_check('5 * 42', 'mlL5EL42E')
+ expr_check('5 / 42', 'dvL5EL42E')
+ expr_check('5 % 42', 'rmL5EL42E')
# ['.*', '->*']
- exprCheck('5 .* 42', 'dsL5EL42E')
- exprCheck('5 ->* 42', 'pmL5EL42E')
+ expr_check('5 .* 42', 'dsL5EL42E')
+ expr_check('5 ->* 42', 'pmL5EL42E')
# conditional
- exprCheck('5 ? 7 : 3', 'quL5EL7EL3E')
+ expr_check('5 ? 7 : 3', 'quL5EL7EL3E')
# assignment
- exprCheck('a = 5', 'aS1aL5E')
- exprCheck('a *= 5', 'mL1aL5E')
- exprCheck('a /= 5', 'dV1aL5E')
- exprCheck('a %= 5', 'rM1aL5E')
- exprCheck('a += 5', 'pL1aL5E')
- exprCheck('a -= 5', 'mI1aL5E')
- exprCheck('a >>= 5', 'rS1aL5E')
- exprCheck('a <<= 5', 'lS1aL5E')
- exprCheck('a &= 5', 'aN1aL5E')
- exprCheck('a and_eq 5', 'aN1aL5E')
- exprCheck('a ^= 5', 'eO1aL5E')
- exprCheck('a xor_eq 5', 'eO1aL5E')
- exprCheck('a |= 5', 'oR1aL5E')
- exprCheck('a or_eq 5', 'oR1aL5E')
- exprCheck('a = {{1, 2, 3}}', 'aS1ailL1EL2EL3EE')
+ expr_check('a = 5', 'aS1aL5E')
+ expr_check('a *= 5', 'mL1aL5E')
+ expr_check('a /= 5', 'dV1aL5E')
+ expr_check('a %= 5', 'rM1aL5E')
+ expr_check('a += 5', 'pL1aL5E')
+ expr_check('a -= 5', 'mI1aL5E')
+ expr_check('a >>= 5', 'rS1aL5E')
+ expr_check('a <<= 5', 'lS1aL5E')
+ expr_check('a &= 5', 'aN1aL5E')
+ expr_check('a and_eq 5', 'aN1aL5E')
+ expr_check('a ^= 5', 'eO1aL5E')
+ expr_check('a xor_eq 5', 'eO1aL5E')
+ expr_check('a |= 5', 'oR1aL5E')
+ expr_check('a or_eq 5', 'oR1aL5E')
+ expr_check('a = {{1, 2, 3}}', 'aS1ailL1EL2EL3EE')
# complex assignment and conditional
- exprCheck('5 = 6 = 7', 'aSL5EaSL6EL7E')
- exprCheck('5 = 6 ? 7 = 8 : 3', 'aSL5EquL6EaSL7EL8EL3E')
+ expr_check('5 = 6 = 7', 'aSL5EaSL6EL7E')
+ expr_check('5 = 6 ? 7 = 8 : 3', 'aSL5EquL6EaSL7EL8EL3E')
# comma operator
- exprCheck('a, 5', 'cm1aL5E')
+ expr_check('a, 5', 'cm1aL5E')
# Additional tests
# a < expression that starts with something that could be a template
- exprCheck('A < 42', 'lt1AL42E')
+ expr_check('A < 42', 'lt1AL42E')
check(
'function',
'template<> void f(A &v)',
{2: 'IE1fR1AI1BX2EE', 3: 'IE1fR1AI1BXL2EEE', 4: 'IE1fvR1AI1BXL2EEE'},
)
- exprCheck('A<1>::value', 'N1AIXL1EEE5valueE')
+ expr_check('A<1>::value', 'N1AIXL1EEE5valueE')
check('class', 'template {key}A', {2: 'I_iE1A'})
check('enumerator', '{key}A = std::numeric_limits::max()', {2: '1A'})
- exprCheck('operator()()', 'clclE')
- exprCheck('operator()()', 'clclIiEE')
+ expr_check('operator()()', 'clclE')
+ expr_check('operator()()', 'clclIiEE')
# pack expansion
- exprCheck('a(b(c, 1 + d...)..., e(f..., g))', 'cl1aspcl1b1cspplL1E1dEcl1esp1f1gEE')
+ expr_check('a(b(c, 1 + d...)..., e(f..., g))', 'cl1aspcl1b1cspplL1E1dEcl1esp1f1gEE')
def test_domain_cpp_ast_type_definitions():
@@ -1062,17 +1062,17 @@ def test_domain_cpp_ast_enum_definitions():
def test_domain_cpp_ast_anon_definitions():
- check('class', '@a', {3: 'Ut1_a'}, asTextOutput='class [anonymous]')
- check('union', '@a', {3: 'Ut1_a'}, asTextOutput='union [anonymous]')
- check('enum', '@a', {3: 'Ut1_a'}, asTextOutput='enum [anonymous]')
- check('class', '@1', {3: 'Ut1_1'}, asTextOutput='class [anonymous]')
- check('class', '@a::A', {3: 'NUt1_a1AE'}, asTextOutput='class [anonymous]::A')
+ check('class', '@a', {3: 'Ut1_a'}, as_text_output='class [anonymous]')
+ check('union', '@a', {3: 'Ut1_a'}, as_text_output='union [anonymous]')
+ check('enum', '@a', {3: 'Ut1_a'}, as_text_output='enum [anonymous]')
+ check('class', '@1', {3: 'Ut1_1'}, as_text_output='class [anonymous]')
+ check('class', '@a::A', {3: 'NUt1_a1AE'}, as_text_output='class [anonymous]::A')
check(
'function',
'int f(int @a)',
{1: 'f__i', 2: '1fi'},
- asTextOutput='int f(int [anonymous])',
+ as_text_output='int f(int [anonymous])',
)
@@ -1370,37 +1370,37 @@ def test_domain_cpp_ast_template_args():
def test_domain_cpp_ast_initializers():
- idsMember = {1: 'v__T', 2: '1v'}
- idsFunction = {1: 'f__T', 2: '1f1T'}
- idsTemplate = {2: 'I_1TE1fv', 4: 'I_1TE1fvv'}
+ ids_member = {1: 'v__T', 2: '1v'}
+ ids_function = {1: 'f__T', 2: '1f1T'}
+ ids_template = {2: 'I_1TE1fv', 4: 'I_1TE1fvv'}
# no init
- check('member', 'T v', idsMember)
- check('function', 'void f(T v)', idsFunction)
- check('function', 'template void f()', idsTemplate)
+ check('member', 'T v', ids_member)
+ check('function', 'void f(T v)', ids_function)
+ check('function', 'template void f()', ids_template)
# with '=', assignment-expression
- check('member', 'T v = 42', idsMember)
- check('function', 'void f(T v = 42)', idsFunction)
- check('function', 'template void f()', idsTemplate)
+ check('member', 'T v = 42', ids_member)
+ check('function', 'void f(T v = 42)', ids_function)
+ check('function', 'template void f()', ids_template)
# with '=', braced-init
- check('member', 'T v = {}', idsMember)
- check('function', 'void f(T v = {})', idsFunction)
- check('function', 'template void f()', idsTemplate)
- check('member', 'T v = {42, 42, 42}', idsMember)
- check('function', 'void f(T v = {42, 42, 42})', idsFunction)
- check('function', 'template void f()', idsTemplate)
- check('member', 'T v = {42, 42, 42,}', idsMember)
- check('function', 'void f(T v = {42, 42, 42,})', idsFunction)
- check('function', 'template void f()', idsTemplate)
- check('member', 'T v = {42, 42, args...}', idsMember)
- check('function', 'void f(T v = {42, 42, args...})', idsFunction)
- check('function', 'template void f()', idsTemplate)
+ check('member', 'T v = {}', ids_member)
+ check('function', 'void f(T v = {})', ids_function)
+ check('function', 'template void f()', ids_template)
+ check('member', 'T v = {42, 42, 42}', ids_member)
+ check('function', 'void f(T v = {42, 42, 42})', ids_function)
+ check('function', 'template void f()', ids_template)
+ check('member', 'T v = {42, 42, 42,}', ids_member)
+ check('function', 'void f(T v = {42, 42, 42,})', ids_function)
+ check('function', 'template void f()', ids_template)
+ check('member', 'T v = {42, 42, args...}', ids_member)
+ check('function', 'void f(T v = {42, 42, args...})', ids_function)
+ check('function', 'template void f()', ids_template)
# without '=', braced-init
- check('member', 'T v{}', idsMember)
- check('member', 'T v{42, 42, 42}', idsMember)
- check('member', 'T v{42, 42, 42,}', idsMember)
- check('member', 'T v{42, 42, args...}', idsMember)
+ check('member', 'T v{}', ids_member)
+ check('member', 'T v{42, 42, 42}', ids_member)
+ check('member', 'T v{42, 42, 42,}', ids_member)
+ check('member', 'T v{42, 42, args...}', ids_member)
# other
- check('member', 'T v = T{}', idsMember)
+ check('member', 'T v = T{}', ids_member)
def test_domain_cpp_ast_attributes():
@@ -1606,7 +1606,7 @@ def test_domain_cpp_build_misuse_of_roles(app):
ws = filter_warnings(app.warning, 'roles-targets-warn')
# the roles that should be able to generate warnings:
- allRoles = [
+ all_roles = [
'class',
'struct',
'union',
@@ -1618,7 +1618,7 @@ def test_domain_cpp_build_misuse_of_roles(app):
'enum',
'enumerator',
]
- ok = [ # targetType, okRoles
+ ok = [ # target_type, ok_roles
('class', ['class', 'struct', 'type']),
('union', ['union', 'type']),
('func', ['func', 'type']),
@@ -1631,14 +1631,14 @@ def test_domain_cpp_build_misuse_of_roles(app):
('templateParam', ['class', 'struct', 'union', 'member', 'var', 'type']),
]
warn = []
- for targetType, roles in ok:
- txtTargetType = 'function' if targetType == 'func' else targetType
- for r in allRoles:
+ for target_type, roles in ok:
+ txt_target_type = 'function' if target_type == 'func' else target_type
+ for r in all_roles:
if r not in roles:
- warn.append(f'WARNING: cpp:{r} targets a {txtTargetType} (')
- if targetType == 'templateParam':
- warn.append(f'WARNING: cpp:{r} targets a {txtTargetType} (')
- warn.append(f'WARNING: cpp:{r} targets a {txtTargetType} (')
+ warn.append(f'WARNING: cpp:{r} targets a {txt_target_type} (')
+ if target_type == 'templateParam':
+ warn.append(f'WARNING: cpp:{r} targets a {txt_target_type} (')
+ warn.append(f'WARNING: cpp:{r} targets a {txt_target_type} (')
warn = sorted(warn)
for w in ws:
assert 'targets a' in w
@@ -1665,14 +1665,14 @@ def test_domain_cpp_build_misuse_of_roles(app):
def test_domain_cpp_build_with_add_function_parentheses_is_True(app):
app.build(force_all=True)
- rolePatterns = [
+ role_patterns = [
'Sphinx',
'Sphinx::version',
'version',
'List',
'MyEnum',
]
- parenPatterns = [
+ paren_patterns = [
('ref function without parens ', r'paren_1\(\)'),
('ref function with parens ', r'paren_2\(\)'),
('ref function without parens, explicit title ', 'paren_3_title'),
@@ -1684,19 +1684,19 @@ def test_domain_cpp_build_with_add_function_parentheses_is_True(app):
]
text = (app.outdir / 'roles.html').read_text(encoding='utf8')
- for ref_text in rolePatterns:
+ for ref_text in role_patterns:
pattern = (
f'{ref_text}
'
)
match = re.search(pattern, text)
assert match is not None, f'Pattern not found in roles.html:\n\t{pattern}'
- for desc_text, ref_text in parenPatterns:
+ for desc_text, ref_text in paren_patterns:
pattern = f'{desc_text}{ref_text}
'
match = re.search(pattern, text)
assert match is not None, f'Pattern not found in roles.html:\n\t{pattern}'
text = (app.outdir / 'any-role.html').read_text(encoding='utf8')
- for desc_text, ref_text in parenPatterns:
+ for desc_text, ref_text in paren_patterns:
pattern = f'{desc_text}{ref_text}
'
match = re.search(pattern, text)
assert match is not None, f'Pattern not found in any-role.html:\n\t{pattern}'
@@ -1710,14 +1710,14 @@ def test_domain_cpp_build_with_add_function_parentheses_is_True(app):
def test_domain_cpp_build_with_add_function_parentheses_is_False(app):
app.build(force_all=True)
- rolePatterns = [
+ role_patterns = [
'Sphinx',
'Sphinx::version',
'version',
'List',
'MyEnum',
]
- parenPatterns = [
+ paren_patterns = [
('ref function without parens ', 'paren_1'),
('ref function with parens ', 'paren_2'),
('ref function without parens, explicit title ', 'paren_3_title'),
@@ -1729,19 +1729,19 @@ def test_domain_cpp_build_with_add_function_parentheses_is_False(app):
]
text = (app.outdir / 'roles.html').read_text(encoding='utf8')
- for ref_text in rolePatterns:
+ for ref_text in role_patterns:
pattern = (
f'{ref_text}
'
)
match = re.search(pattern, text)
assert match is not None, f'Pattern not found in roles.html:\n\t{pattern}'
- for desc_text, ref_text in parenPatterns:
+ for desc_text, ref_text in paren_patterns:
pattern = f'{desc_text}{ref_text}
'
match = re.search(pattern, text)
assert match is not None, f'Pattern not found in roles.html:\n\t{pattern}'
text = (app.outdir / 'any-role.html').read_text(encoding='utf8')
- for desc_text, ref_text in parenPatterns:
+ for desc_text, ref_text in paren_patterns:
pattern = f'{desc_text}{ref_text}
'
match = re.search(pattern, text)
assert match is not None, f'Pattern not found in any-role.html:\n\t{pattern}'
@@ -1843,7 +1843,7 @@ def test_domain_cpp_build_operator_lookup(app):
'html', testroot='domain-cpp-intersphinx', confoverrides={'nitpicky': True}
)
def test_domain_cpp_build_intersphinx(tmp_path, app):
- origSource = """\
+ orig_source = """\
.. cpp:class:: _class
.. cpp:struct:: _struct
.. cpp:union:: _union
diff --git a/tests/test_domains/test_domain_std.py b/tests/test_domains/test_domain_std.py
index eb01c8e70..b253f28e3 100644
--- a/tests/test_domains/test_domain_std.py
+++ b/tests/test_domains/test_domain_std.py
@@ -522,8 +522,8 @@ def test_productionlist(app):
assert len(code_list) == 1
span = code_list[0]
assert span.tag == 'span'
- linkText = span.text.strip()
- cases.append((text, link, linkText))
+ link_text = span.text.strip()
+ cases.append((text, link, link_text))
assert cases == [
('A', 'Bare.html#grammar-token-A', 'A'),
('B', 'Bare.html#grammar-token-B', 'B'),