Skip to content

Commit a980fbc

Browse files
committed
Add return annotation to several zero-argument test functions
1 parent 2364f16 commit a980fbc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+246
-244
lines changed

tests/test_builders/test_build_html_assets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def test_file_checksum(app):
138138
assert '<script src="https://example.com/script.js"></script>' in content
139139

140140

141-
def test_file_checksum_query_string():
141+
def test_file_checksum_query_string() -> None:
142142
with pytest.raises(
143143
ThemeError,
144144
match='Local asset file paths must not contain query strings',

tests/test_builders/test_build_manpage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def ruby?
9696
assert expected in content
9797

9898

99-
def test_default_man_pages():
99+
def test_default_man_pages() -> None:
100100
config = Config({
101101
'project': 'STASI™ Documentation',
102102
'author': "Wolfgang Schäuble & G'Beckstein",

tests/test_builders/test_build_texinfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def test_texinfo_citation(app):
6464
) in output
6565

6666

67-
def test_default_texinfo_documents():
67+
def test_default_texinfo_documents() -> None:
6868
config = Config({
6969
'project': 'STASI™ Documentation',
7070
'author': "Wolfgang Schäuble & G'Beckstein",

tests/test_config/test_config.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def test_extension_values():
312312
assert 'already present' in str(excinfo.value)
313313

314314

315-
def test_overrides():
315+
def test_overrides() -> None:
316316
config = Config(
317317
{'value1': '1', 'value2': 2, 'value6': {'default': 6}},
318318
{
@@ -343,7 +343,7 @@ def test_overrides():
343343
assert config.value8 == ['abc', 'def', 'ghi']
344344

345345

346-
def test_overrides_boolean():
346+
def test_overrides_boolean() -> None:
347347
config = Config({}, {'value1': '1', 'value2': '0', 'value3': '0'})
348348
config.add('value1', None, 'env', [bool])
349349
config.add('value2', None, 'env', [bool])
@@ -372,7 +372,7 @@ def test_overrides_dict_str(logger):
372372
)
373373

374374

375-
def test_callable_defer():
375+
def test_callable_defer() -> None:
376376
config = Config()
377377
config.add('alias', lambda c: c.master_doc, '', str)
378378

@@ -725,7 +725,7 @@ def test_conf_py_nitpick_ignore_list(tmp_path):
725725
assert cfg.nitpick_ignore_regex == []
726726

727727

728-
def test_gettext_compact_command_line_true():
728+
def test_gettext_compact_command_line_true() -> None:
729729
config = Config({}, {'gettext_compact': '1'})
730730
config.add('gettext_compact', True, '', {bool, str})
731731

@@ -734,7 +734,7 @@ def test_gettext_compact_command_line_true():
734734
assert config.gettext_compact is True
735735

736736

737-
def test_gettext_compact_command_line_false():
737+
def test_gettext_compact_command_line_false() -> None:
738738
config = Config({}, {'gettext_compact': '0'})
739739
config.add('gettext_compact', True, '', {bool, str})
740740

@@ -743,7 +743,7 @@ def test_gettext_compact_command_line_false():
743743
assert config.gettext_compact is False
744744

745745

746-
def test_gettext_compact_command_line_str():
746+
def test_gettext_compact_command_line_str() -> None:
747747
config = Config({}, {'gettext_compact': 'spam'})
748748
config.add('gettext_compact', True, '', {bool, str})
749749

@@ -752,31 +752,31 @@ def test_gettext_compact_command_line_str():
752752
assert config.gettext_compact == 'spam'
753753

754754

755-
def test_translation_progress_classes_command_line():
755+
def test_translation_progress_classes_command_line() -> None:
756756
config = Config({}, {'translation_progress_classes': '1'})
757757

758758
# regression test for --define translation_progress_classes=1
759759
# https://github.com/sphinx-doc/sphinx/issues/13071
760760
assert config.translation_progress_classes is True
761761

762762

763-
def test_translation_progress_classes_command_line_false():
763+
def test_translation_progress_classes_command_line_false() -> None:
764764
config = Config({}, {'translation_progress_classes': '0'})
765765

766766
# regression test for --define translation_progress_classes=0
767767
# https://github.com/sphinx-doc/sphinx/issues/13071
768768
assert config.translation_progress_classes is False
769769

770770

771-
def test_translation_progress_classes_command_line_str():
771+
def test_translation_progress_classes_command_line_str() -> None:
772772
config = Config({}, {'translation_progress_classes': 'translated'})
773773

774774
# regression test for --define translation_progress_classes=translated
775775
# https://github.com/sphinx-doc/sphinx/issues/13071
776776
assert config.translation_progress_classes == 'translated'
777777

778778

779-
def test_autosummary_generate_command_line_false():
779+
def test_autosummary_generate_command_line_false() -> None:
780780
config = Config({}, {'autosummary_generate': '0'})
781781
config.add('autosummary_generate', True, '', {bool, list})
782782

@@ -785,7 +785,7 @@ def test_autosummary_generate_command_line_false():
785785
assert config.autosummary_generate is False
786786

787787

788-
def test_boolean_command_line_invalid():
788+
def test_boolean_command_line_invalid() -> None:
789789
config = Config({}, {'rabit_of_caerbannog': ''})
790790
config.add('rabit_of_caerbannog', True, '', {bool})
791791
with pytest.raises(
@@ -794,7 +794,7 @@ def test_boolean_command_line_invalid():
794794
_ = config.rabit_of_caerbannog
795795

796796

797-
def test_root_doc_and_master_doc_are_synchronized():
797+
def test_root_doc_and_master_doc_are_synchronized() -> None:
798798
c = Config()
799799
assert c.master_doc == 'index'
800800
assert c.root_doc == c.master_doc

tests/test_domains/test_domain_c.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def check(name, input, id_dict, output=None, key=None, as_text_output=None):
135135
)
136136

137137

138-
def test_domain_c_ast_expressions():
138+
def test_domain_c_ast_expressions() -> None:
139139
def expr_check(expr, output=None):
140140
parser = DefinitionParser(expr, location=None, config=Config())
141141
parser.allowFallbackExpressionParsing = False
@@ -336,7 +336,7 @@ def expr_check(expr, output=None):
336336
expr_check('a or_eq 5')
337337

338338

339-
def test_domain_c_ast_fundamental_types():
339+
def test_domain_c_ast_fundamental_types() -> None:
340340
def types():
341341
def signed(t):
342342
yield t
@@ -403,7 +403,7 @@ def signed(t):
403403
check('type', input, {1: 'foo'}, key='typedef', output=output)
404404

405405

406-
def test_domain_c_ast_type_definitions():
406+
def test_domain_c_ast_type_definitions() -> None:
407407
check('type', '{key}T', {1: 'T'})
408408

409409
check('type', '{key}bool *b', {1: 'b'}, key='typedef')
@@ -429,7 +429,7 @@ def test_domain_c_ast_type_definitions():
429429
)
430430

431431

432-
def test_domain_c_ast_macro_definitions():
432+
def test_domain_c_ast_macro_definitions() -> None:
433433
check('macro', 'M', {1: 'M'})
434434
check('macro', 'M()', {1: 'M'})
435435
check('macro', 'M(arg)', {1: 'M'})
@@ -445,7 +445,7 @@ def test_domain_c_ast_macro_definitions():
445445
check('macro', 'M(arg1, arg2..., arg3)', {1: 'M'})
446446

447447

448-
def test_domain_c_ast_member_definitions():
448+
def test_domain_c_ast_member_definitions() -> None:
449449
check('member', 'void a', {1: 'a'})
450450
check('member', '_Bool a', {1: 'a'})
451451
check('member', 'bool a', {1: 'a'})
@@ -501,7 +501,7 @@ def test_domain_c_ast_member_definitions():
501501
check('member', 'int b : 3', {1: 'b'})
502502

503503

504-
def test_domain_c_ast_function_definitions():
504+
def test_domain_c_ast_function_definitions() -> None:
505505
check('function', 'void f()', {1: 'f'})
506506
check('function', 'void f(int)', {1: 'f'})
507507
check('function', 'void f(int i)', {1: 'f'})
@@ -570,37 +570,37 @@ def test_domain_c_ast_function_definitions():
570570
check('function', 'void f(void (*p)(int, double), int i)', {1: 'f'})
571571

572572

573-
def test_domain_c_ast_nested_name():
573+
def test_domain_c_ast_nested_name() -> None:
574574
check('struct', '{key}.A', {1: 'A'})
575575
check('struct', '{key}.A.B', {1: 'A.B'})
576576
check('function', 'void f(.A a)', {1: 'f'})
577577
check('function', 'void f(.A.B a)', {1: 'f'})
578578

579579

580-
def test_domain_c_ast_struct_definitions():
580+
def test_domain_c_ast_struct_definitions() -> None:
581581
check('struct', '{key}A', {1: 'A'})
582582

583583

584-
def test_domain_c_ast_union_definitions():
584+
def test_domain_c_ast_union_definitions() -> None:
585585
check('union', '{key}A', {1: 'A'})
586586

587587

588-
def test_domain_c_ast_enum_definitions():
588+
def test_domain_c_ast_enum_definitions() -> None:
589589
check('enum', '{key}A', {1: 'A'})
590590

591591
check('enumerator', '{key}A', {1: 'A'})
592592
check('enumerator', '{key}A = 42', {1: 'A'})
593593

594594

595-
def test_domain_c_ast_anon_definitions():
595+
def test_domain_c_ast_anon_definitions() -> None:
596596
check('struct', '@a', {1: '@a'}, as_text_output='struct [anonymous]')
597597
check('union', '@a', {1: '@a'}, as_text_output='union [anonymous]')
598598
check('enum', '@a', {1: '@a'}, as_text_output='enum [anonymous]')
599599
check('struct', '@1', {1: '@1'}, as_text_output='struct [anonymous]')
600600
check('struct', '@a.A', {1: '@a.A'}, as_text_output='struct [anonymous].A')
601601

602602

603-
def test_domain_c_ast_initializers():
603+
def test_domain_c_ast_initializers() -> None:
604604
ids_member = {1: 'v'}
605605
ids_function = {1: 'f'}
606606
# no init
@@ -619,7 +619,7 @@ def test_domain_c_ast_initializers():
619619
# TODO: designator-list
620620

621621

622-
def test_domain_c_ast_attributes():
622+
def test_domain_c_ast_attributes() -> None:
623623
# style: C++
624624
check('member', '[[]] int f', {1: 'f'})
625625
check(
@@ -688,12 +688,12 @@ def test_domain_c_ast_attributes():
688688
)
689689

690690

691-
def test_extra_keywords():
691+
def test_extra_keywords() -> None:
692692
with pytest.raises(DefinitionError, match='Expected identifier in nested name'):
693693
parse('function', 'void complex(void)')
694694

695695

696-
# def test_print():
696+
# def test_print() -> None:
697697
# # used for getting all the ids out for checking
698698
# for a in ids:
699699
# print(a)

0 commit comments

Comments
 (0)