winipedia-utils 0.2.10__py3-none-any.whl → 0.2.17__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of winipedia-utils might be problematic. Click here for more details.

Files changed (69) hide show
  1. winipedia_utils/concurrent/concurrent.py +245 -245
  2. winipedia_utils/concurrent/multiprocessing.py +130 -130
  3. winipedia_utils/concurrent/multithreading.py +93 -93
  4. winipedia_utils/consts.py +21 -21
  5. winipedia_utils/data/__init__.py +1 -1
  6. winipedia_utils/data/dataframe/__init__.py +1 -1
  7. winipedia_utils/data/dataframe/cleaning.py +378 -378
  8. winipedia_utils/data/structures/__init__.py +1 -1
  9. winipedia_utils/data/structures/dicts.py +16 -16
  10. winipedia_utils/git/__init__.py +1 -1
  11. winipedia_utils/git/gitignore/__init__.py +1 -1
  12. winipedia_utils/git/gitignore/gitignore.py +136 -136
  13. winipedia_utils/git/pre_commit/__init__.py +1 -1
  14. winipedia_utils/git/pre_commit/config.py +70 -70
  15. winipedia_utils/git/pre_commit/hooks.py +127 -109
  16. winipedia_utils/git/pre_commit/run_hooks.py +49 -49
  17. winipedia_utils/iterating/__init__.py +1 -1
  18. winipedia_utils/iterating/iterate.py +29 -29
  19. winipedia_utils/logging/ansi.py +6 -6
  20. winipedia_utils/logging/config.py +64 -64
  21. winipedia_utils/logging/logger.py +26 -26
  22. winipedia_utils/modules/class_.py +119 -119
  23. winipedia_utils/modules/function.py +101 -101
  24. winipedia_utils/modules/module.py +379 -379
  25. winipedia_utils/modules/package.py +390 -390
  26. winipedia_utils/oop/mixins/meta.py +333 -333
  27. winipedia_utils/oop/mixins/mixin.py +37 -37
  28. winipedia_utils/os/__init__.py +1 -1
  29. winipedia_utils/os/os.py +63 -63
  30. winipedia_utils/projects/__init__.py +1 -1
  31. winipedia_utils/projects/poetry/__init__.py +1 -1
  32. winipedia_utils/projects/poetry/config.py +117 -117
  33. winipedia_utils/projects/poetry/poetry.py +31 -31
  34. winipedia_utils/projects/project.py +48 -48
  35. winipedia_utils/resources/__init__.py +1 -1
  36. winipedia_utils/resources/svgs/__init__.py +1 -1
  37. winipedia_utils/resources/svgs/download_arrow.svg +2 -2
  38. winipedia_utils/resources/svgs/exit_fullscreen_icon.svg +5 -5
  39. winipedia_utils/resources/svgs/fullscreen_icon.svg +2 -2
  40. winipedia_utils/resources/svgs/menu_icon.svg +3 -3
  41. winipedia_utils/resources/svgs/pause_icon.svg +3 -3
  42. winipedia_utils/resources/svgs/play_icon.svg +16 -16
  43. winipedia_utils/resources/svgs/plus_icon.svg +23 -23
  44. winipedia_utils/resources/svgs/svg.py +15 -15
  45. winipedia_utils/security/__init__.py +1 -1
  46. winipedia_utils/security/cryptography.py +29 -29
  47. winipedia_utils/security/keyring.py +70 -70
  48. winipedia_utils/setup.py +47 -47
  49. winipedia_utils/testing/assertions.py +23 -23
  50. winipedia_utils/testing/convention.py +177 -177
  51. winipedia_utils/testing/create_tests.py +297 -297
  52. winipedia_utils/testing/fixtures.py +28 -28
  53. winipedia_utils/testing/tests/base/fixtures/__init__.py +1 -1
  54. winipedia_utils/testing/tests/base/fixtures/fixture.py +6 -6
  55. winipedia_utils/testing/tests/base/fixtures/scopes/class_.py +33 -33
  56. winipedia_utils/testing/tests/base/fixtures/scopes/function.py +7 -7
  57. winipedia_utils/testing/tests/base/fixtures/scopes/module.py +33 -33
  58. winipedia_utils/testing/tests/base/fixtures/scopes/package.py +7 -7
  59. winipedia_utils/testing/tests/base/fixtures/scopes/session.py +296 -296
  60. winipedia_utils/testing/tests/base/utils/utils.py +111 -111
  61. winipedia_utils/testing/tests/conftest.py +32 -32
  62. winipedia_utils/text/string.py +126 -126
  63. winipedia_utils-0.2.17.dist-info/METADATA +716 -0
  64. winipedia_utils-0.2.17.dist-info/RECORD +80 -0
  65. {winipedia_utils-0.2.10.dist-info → winipedia_utils-0.2.17.dist-info}/licenses/LICENSE +21 -21
  66. winipedia_utils/testing/tests/test_0.py +0 -8
  67. winipedia_utils-0.2.10.dist-info/METADATA +0 -355
  68. winipedia_utils-0.2.10.dist-info/RECORD +0 -81
  69. {winipedia_utils-0.2.10.dist-info → winipedia_utils-0.2.17.dist-info}/WHEEL +0 -0
@@ -1,297 +1,297 @@
1
- """Utilities for automatically creating test files for the project.
2
-
3
- This module provides functions to generate test files for all modules and classes
4
- in the project, ensuring that every function and method has a corresponding test.
5
- It creates the basic test structure and generates skeleton test functions with
6
- NotImplementedError to indicate tests that need to be written.
7
- """
8
-
9
- from pathlib import Path
10
- from types import ModuleType
11
- from typing import cast
12
-
13
- from winipedia_utils.modules.class_ import (
14
- get_all_cls_from_module,
15
- get_all_methods_from_cls,
16
- )
17
- from winipedia_utils.modules.function import get_all_functions_from_module
18
- from winipedia_utils.modules.module import (
19
- create_module,
20
- get_isolated_obj_name,
21
- get_module_content_as_str,
22
- get_qualname_of_obj,
23
- to_path,
24
- )
25
- from winipedia_utils.modules.package import (
26
- copy_package,
27
- get_src_package,
28
- walk_package,
29
- )
30
- from winipedia_utils.testing import tests
31
- from winipedia_utils.testing.convention import (
32
- TESTS_PACKAGE_NAME,
33
- get_test_obj_from_obj,
34
- make_test_obj_importpath_from_obj,
35
- make_test_obj_name,
36
- reverse_make_test_obj_name,
37
- )
38
- from winipedia_utils.testing.tests.base.utils.utils import (
39
- _conftest_content_is_correct,
40
- _get_conftest_content,
41
- _get_test_0_content,
42
- _test_0_content_is_correct,
43
- )
44
-
45
-
46
- def create_tests() -> None:
47
- """Create all test files for the project.
48
-
49
- This function orchestrates the test creation process by first setting up the base
50
- test structure and then creating test files for all source packages.
51
- """
52
- create_tests_base()
53
- create_tests_for_src_package()
54
-
55
-
56
- def create_tests_base() -> None:
57
- """Create the base test structure.
58
-
59
- This function:
60
- 1. Creates a mirror of winipedia_utils.testing.tests in the tests directory
61
- 2. Skips copying __init__.py file contents
62
- 3. Writes new __init__.py files for all packages
63
- 4. Creates a conftest.py file with the appropriate pytest plugin configuration
64
- 5. Does not overwrite anything if it already exists except conftest.py
65
- """
66
- tests_path = Path(TESTS_PACKAGE_NAME)
67
- copy_package(
68
- src_package=tests,
69
- dst=".",
70
- with_file_content=False,
71
- )
72
- # write pytest_plugin in the conftest.py
73
- conftest_path = tests_path / "conftest.py"
74
- # if conftest does not exist or the content is not the same, overwrite it
75
- if not _conftest_content_is_correct(conftest_path):
76
- conftest_path.write_text(_get_conftest_content())
77
-
78
- test_0_path = tests_path / "test_0.py"
79
- if not _test_0_content_is_correct(test_0_path):
80
- test_0_path.write_text(_get_test_0_content())
81
-
82
-
83
- def create_tests_for_src_package() -> None:
84
- """Create test files for all modules in the source package.
85
-
86
- This function walks through the source package hierarchy and creates corresponding
87
- test packages and modules for each package and module found in the source.
88
- """
89
- src_package = get_src_package()
90
- for package, modules in walk_package(src_package):
91
- create_test_package(package)
92
- for module in modules:
93
- create_test_module(module)
94
-
95
-
96
- def create_test_package(package: ModuleType) -> None:
97
- """Create a test package for a source package.
98
-
99
- Args:
100
- package: The source package module to create a test package for
101
-
102
- This function creates a test package with the appropriate naming convention
103
- if it doesn't already exist.
104
-
105
- """
106
- test_package_name = make_test_obj_importpath_from_obj(package)
107
- # create package if it doesn't exist
108
- create_module(test_package_name, is_package=True)
109
-
110
-
111
- def create_test_module(module: ModuleType) -> None:
112
- """Create a test module for a source module.
113
-
114
- Args:
115
- module: The source module to create a test module for
116
-
117
- This function:
118
- 1. Creates a test module with the appropriate naming convention
119
- 2. Generates the test module content with skeleton test functions
120
- 3. Writes the content to the test module file
121
-
122
- """
123
- test_module_name = make_test_obj_importpath_from_obj(module)
124
- test_module = create_module(test_module_name, is_package=False)
125
- test_module_path = to_path(test_module, is_package=False)
126
- test_module_path.write_text(get_test_module_content(module))
127
-
128
-
129
- def get_test_module_content(module: ModuleType) -> str:
130
- """Generate the content for a test module.
131
-
132
- Args:
133
- module: The source module to generate test content for
134
-
135
- Returns:
136
- The generated test module content as a string
137
-
138
- This function:
139
- 1. Gets the existing test module content if it exists
140
- 2. Adds test functions for all functions in the source module
141
- 3. Adds test classes for all classes in the source module
142
-
143
- """
144
- test_module = cast("ModuleType", (get_test_obj_from_obj(module)))
145
- test_module_content = get_module_content_as_str(test_module)
146
-
147
- test_module_content = get_test_functions_content(
148
- module, test_module, test_module_content
149
- )
150
-
151
- return get_test_classes_content(module, test_module, test_module_content)
152
-
153
-
154
- def get_test_functions_content(
155
- module: ModuleType,
156
- test_module: ModuleType,
157
- test_module_content: str,
158
- ) -> str:
159
- """Generate test function content for a module.
160
-
161
- Args:
162
- module: The source module containing functions to test
163
- test_module: The test module to add function tests to
164
- test_module_content: The current content of the test module
165
-
166
- Returns:
167
- The updated test module content with function tests added
168
-
169
- This function:
170
- 1. Identifies all functions in the source module
171
- 2. Determines which functions don't have corresponding tests
172
- 3. Generates skeleton test functions for untested functions
173
-
174
- """
175
- funcs = get_all_functions_from_module(module)
176
- test_functions = get_all_functions_from_module(test_module)
177
- supposed_test_funcs_names = [make_test_obj_name(f) for f in funcs]
178
-
179
- test_funcs_names = [get_qualname_of_obj(f) for f in test_functions]
180
-
181
- untested_funcs_names = [
182
- f for f in supposed_test_funcs_names if f not in test_funcs_names
183
- ]
184
-
185
- for test_func_name in untested_funcs_names:
186
- test_module_content += f"""
187
-
188
- def {test_func_name}() -> None:
189
- \"\"\"Test func for {reverse_make_test_obj_name(test_func_name)}.\"\"\"
190
- raise {NotImplementedError.__name__}
191
- """
192
-
193
- return test_module_content
194
-
195
-
196
- def get_test_classes_content(
197
- module: ModuleType,
198
- test_module: ModuleType,
199
- test_module_content: str,
200
- ) -> str:
201
- """Generate test class content for a module.
202
-
203
- Args:
204
- module: The source module containing classes to test
205
- test_module: The test module to add class tests to
206
- test_module_content: The current content of the test module
207
-
208
- Returns:
209
- The updated test module content with class tests added
210
-
211
- This function:
212
- 1. Identifies all classes in the source module
213
- 2. Determines which classes and methods don't have corresponding tests
214
- 3. Generates skeleton test classes and methods for untested classes and methods
215
- 4. Inserts the new test classes into the existing content
216
- if the class already exists
217
-
218
- Raises:
219
- ValueError: If a test class declaration appears multiple
220
- times in the test module
221
-
222
- """
223
- classes = get_all_cls_from_module(module)
224
- test_classes = get_all_cls_from_module(test_module)
225
-
226
- class_to_methods = {
227
- c: get_all_methods_from_cls(c, exclude_parent_methods=True) for c in classes
228
- }
229
- test_class_to_methods = {
230
- tc: get_all_methods_from_cls(tc, exclude_parent_methods=True)
231
- for tc in test_classes
232
- }
233
-
234
- supposed_test_class_to_methods_names = {
235
- make_test_obj_name(c): [make_test_obj_name(m) for m in ms]
236
- for c, ms in class_to_methods.items()
237
- }
238
- test_class_to_methods_names = {
239
- get_isolated_obj_name(tc): [get_isolated_obj_name(tm) for tm in tms]
240
- for tc, tms in test_class_to_methods.items()
241
- }
242
-
243
- untested_test_class_to_methods_names: dict[str, list[str]] = {}
244
- for (
245
- test_class_name,
246
- supposed_test_methods_names,
247
- ) in supposed_test_class_to_methods_names.items():
248
- test_methods_names = test_class_to_methods_names.get(test_class_name, [])
249
- untested_methods_names = [
250
- tmn for tmn in supposed_test_methods_names if tmn not in test_methods_names
251
- ]
252
- if (
253
- not supposed_test_methods_names
254
- and test_class_name not in test_class_to_methods_names
255
- ):
256
- untested_test_class_to_methods_names[test_class_name] = []
257
- if untested_methods_names:
258
- untested_test_class_to_methods_names[test_class_name] = (
259
- untested_methods_names
260
- )
261
-
262
- for (
263
- test_class_name,
264
- untested_methods_names,
265
- ) in untested_test_class_to_methods_names.items():
266
- test_class_declaration = f"""
267
- class {test_class_name}:
268
- \"\"\"Test class for {reverse_make_test_obj_name(test_class_name)}.\"\"\"
269
- """
270
- test_class_content = test_class_declaration
271
- for untested_method_name in untested_methods_names:
272
- test_class_content += f"""
273
- def {untested_method_name}(self) -> None:
274
- \"\"\"Test method for {reverse_make_test_obj_name(untested_method_name)}.\"\"\"
275
- raise {NotImplementedError.__name__}
276
- """
277
- parts = test_module_content.split(test_class_declaration)
278
- expected_parts = 2
279
- if len(parts) > expected_parts:
280
- msg = f"Found {len(parts)} parts, expected 2"
281
- raise ValueError(msg)
282
- parts.insert(1, test_class_content)
283
- test_module_content = "".join(parts)
284
-
285
- return test_module_content
286
-
287
-
288
- def main() -> None:
289
- """Entry point for the create_tests script.
290
-
291
- Calls the create_tests function to generate all test files.
292
- """
293
- create_tests()
294
-
295
-
296
- if __name__ == "__main__":
297
- main()
1
+ """Utilities for automatically creating test files for the project.
2
+
3
+ This module provides functions to generate test files for all modules and classes
4
+ in the project, ensuring that every function and method has a corresponding test.
5
+ It creates the basic test structure and generates skeleton test functions with
6
+ NotImplementedError to indicate tests that need to be written.
7
+ """
8
+
9
+ from pathlib import Path
10
+ from types import ModuleType
11
+ from typing import cast
12
+
13
+ from winipedia_utils.modules.class_ import (
14
+ get_all_cls_from_module,
15
+ get_all_methods_from_cls,
16
+ )
17
+ from winipedia_utils.modules.function import get_all_functions_from_module
18
+ from winipedia_utils.modules.module import (
19
+ create_module,
20
+ get_isolated_obj_name,
21
+ get_module_content_as_str,
22
+ get_qualname_of_obj,
23
+ to_path,
24
+ )
25
+ from winipedia_utils.modules.package import (
26
+ copy_package,
27
+ get_src_package,
28
+ walk_package,
29
+ )
30
+ from winipedia_utils.testing import tests
31
+ from winipedia_utils.testing.convention import (
32
+ TESTS_PACKAGE_NAME,
33
+ get_test_obj_from_obj,
34
+ make_test_obj_importpath_from_obj,
35
+ make_test_obj_name,
36
+ reverse_make_test_obj_name,
37
+ )
38
+ from winipedia_utils.testing.tests.base.utils.utils import (
39
+ _conftest_content_is_correct,
40
+ _get_conftest_content,
41
+ _get_test_0_content,
42
+ _test_0_content_is_correct,
43
+ )
44
+
45
+
46
+ def create_tests() -> None:
47
+ """Create all test files for the project.
48
+
49
+ This function orchestrates the test creation process by first setting up the base
50
+ test structure and then creating test files for all source packages.
51
+ """
52
+ create_tests_base()
53
+ create_tests_for_src_package()
54
+
55
+
56
+ def create_tests_base() -> None:
57
+ """Create the base test structure.
58
+
59
+ This function:
60
+ 1. Creates a mirror of winipedia_utils.testing.tests in the tests directory
61
+ 2. Skips copying __init__.py file contents
62
+ 3. Writes new __init__.py files for all packages
63
+ 4. Creates a conftest.py file with the appropriate pytest plugin configuration
64
+ 5. Does not overwrite anything if it already exists except conftest.py
65
+ """
66
+ tests_path = Path(TESTS_PACKAGE_NAME)
67
+ copy_package(
68
+ src_package=tests,
69
+ dst=".",
70
+ with_file_content=False,
71
+ )
72
+ # write pytest_plugin in the conftest.py
73
+ conftest_path = tests_path / "conftest.py"
74
+ # if conftest does not exist or the content is not the same, overwrite it
75
+ if not _conftest_content_is_correct(conftest_path):
76
+ conftest_path.write_text(_get_conftest_content())
77
+
78
+ test_0_path = tests_path / "test_0.py"
79
+ if not _test_0_content_is_correct(test_0_path):
80
+ test_0_path.write_text(_get_test_0_content())
81
+
82
+
83
+ def create_tests_for_src_package() -> None:
84
+ """Create test files for all modules in the source package.
85
+
86
+ This function walks through the source package hierarchy and creates corresponding
87
+ test packages and modules for each package and module found in the source.
88
+ """
89
+ src_package = get_src_package()
90
+ for package, modules in walk_package(src_package):
91
+ create_test_package(package)
92
+ for module in modules:
93
+ create_test_module(module)
94
+
95
+
96
+ def create_test_package(package: ModuleType) -> None:
97
+ """Create a test package for a source package.
98
+
99
+ Args:
100
+ package: The source package module to create a test package for
101
+
102
+ This function creates a test package with the appropriate naming convention
103
+ if it doesn't already exist.
104
+
105
+ """
106
+ test_package_name = make_test_obj_importpath_from_obj(package)
107
+ # create package if it doesn't exist
108
+ create_module(test_package_name, is_package=True)
109
+
110
+
111
+ def create_test_module(module: ModuleType) -> None:
112
+ """Create a test module for a source module.
113
+
114
+ Args:
115
+ module: The source module to create a test module for
116
+
117
+ This function:
118
+ 1. Creates a test module with the appropriate naming convention
119
+ 2. Generates the test module content with skeleton test functions
120
+ 3. Writes the content to the test module file
121
+
122
+ """
123
+ test_module_name = make_test_obj_importpath_from_obj(module)
124
+ test_module = create_module(test_module_name, is_package=False)
125
+ test_module_path = to_path(test_module, is_package=False)
126
+ test_module_path.write_text(get_test_module_content(module))
127
+
128
+
129
+ def get_test_module_content(module: ModuleType) -> str:
130
+ """Generate the content for a test module.
131
+
132
+ Args:
133
+ module: The source module to generate test content for
134
+
135
+ Returns:
136
+ The generated test module content as a string
137
+
138
+ This function:
139
+ 1. Gets the existing test module content if it exists
140
+ 2. Adds test functions for all functions in the source module
141
+ 3. Adds test classes for all classes in the source module
142
+
143
+ """
144
+ test_module = cast("ModuleType", (get_test_obj_from_obj(module)))
145
+ test_module_content = get_module_content_as_str(test_module)
146
+
147
+ test_module_content = get_test_functions_content(
148
+ module, test_module, test_module_content
149
+ )
150
+
151
+ return get_test_classes_content(module, test_module, test_module_content)
152
+
153
+
154
+ def get_test_functions_content(
155
+ module: ModuleType,
156
+ test_module: ModuleType,
157
+ test_module_content: str,
158
+ ) -> str:
159
+ """Generate test function content for a module.
160
+
161
+ Args:
162
+ module: The source module containing functions to test
163
+ test_module: The test module to add function tests to
164
+ test_module_content: The current content of the test module
165
+
166
+ Returns:
167
+ The updated test module content with function tests added
168
+
169
+ This function:
170
+ 1. Identifies all functions in the source module
171
+ 2. Determines which functions don't have corresponding tests
172
+ 3. Generates skeleton test functions for untested functions
173
+
174
+ """
175
+ funcs = get_all_functions_from_module(module)
176
+ test_functions = get_all_functions_from_module(test_module)
177
+ supposed_test_funcs_names = [make_test_obj_name(f) for f in funcs]
178
+
179
+ test_funcs_names = [get_qualname_of_obj(f) for f in test_functions]
180
+
181
+ untested_funcs_names = [
182
+ f for f in supposed_test_funcs_names if f not in test_funcs_names
183
+ ]
184
+
185
+ for test_func_name in untested_funcs_names:
186
+ test_module_content += f"""
187
+
188
+ def {test_func_name}() -> None:
189
+ \"\"\"Test func for {reverse_make_test_obj_name(test_func_name)}.\"\"\"
190
+ raise {NotImplementedError.__name__}
191
+ """
192
+
193
+ return test_module_content
194
+
195
+
196
+ def get_test_classes_content(
197
+ module: ModuleType,
198
+ test_module: ModuleType,
199
+ test_module_content: str,
200
+ ) -> str:
201
+ """Generate test class content for a module.
202
+
203
+ Args:
204
+ module: The source module containing classes to test
205
+ test_module: The test module to add class tests to
206
+ test_module_content: The current content of the test module
207
+
208
+ Returns:
209
+ The updated test module content with class tests added
210
+
211
+ This function:
212
+ 1. Identifies all classes in the source module
213
+ 2. Determines which classes and methods don't have corresponding tests
214
+ 3. Generates skeleton test classes and methods for untested classes and methods
215
+ 4. Inserts the new test classes into the existing content
216
+ if the class already exists
217
+
218
+ Raises:
219
+ ValueError: If a test class declaration appears multiple
220
+ times in the test module
221
+
222
+ """
223
+ classes = get_all_cls_from_module(module)
224
+ test_classes = get_all_cls_from_module(test_module)
225
+
226
+ class_to_methods = {
227
+ c: get_all_methods_from_cls(c, exclude_parent_methods=True) for c in classes
228
+ }
229
+ test_class_to_methods = {
230
+ tc: get_all_methods_from_cls(tc, exclude_parent_methods=True)
231
+ for tc in test_classes
232
+ }
233
+
234
+ supposed_test_class_to_methods_names = {
235
+ make_test_obj_name(c): [make_test_obj_name(m) for m in ms]
236
+ for c, ms in class_to_methods.items()
237
+ }
238
+ test_class_to_methods_names = {
239
+ get_isolated_obj_name(tc): [get_isolated_obj_name(tm) for tm in tms]
240
+ for tc, tms in test_class_to_methods.items()
241
+ }
242
+
243
+ untested_test_class_to_methods_names: dict[str, list[str]] = {}
244
+ for (
245
+ test_class_name,
246
+ supposed_test_methods_names,
247
+ ) in supposed_test_class_to_methods_names.items():
248
+ test_methods_names = test_class_to_methods_names.get(test_class_name, [])
249
+ untested_methods_names = [
250
+ tmn for tmn in supposed_test_methods_names if tmn not in test_methods_names
251
+ ]
252
+ if (
253
+ not supposed_test_methods_names
254
+ and test_class_name not in test_class_to_methods_names
255
+ ):
256
+ untested_test_class_to_methods_names[test_class_name] = []
257
+ if untested_methods_names:
258
+ untested_test_class_to_methods_names[test_class_name] = (
259
+ untested_methods_names
260
+ )
261
+
262
+ for (
263
+ test_class_name,
264
+ untested_methods_names,
265
+ ) in untested_test_class_to_methods_names.items():
266
+ test_class_declaration = f"""
267
+ class {test_class_name}:
268
+ \"\"\"Test class for {reverse_make_test_obj_name(test_class_name)}.\"\"\"
269
+ """
270
+ test_class_content = test_class_declaration
271
+ for untested_method_name in untested_methods_names:
272
+ test_class_content += f"""
273
+ def {untested_method_name}(self) -> None:
274
+ \"\"\"Test method for {reverse_make_test_obj_name(untested_method_name)}.\"\"\"
275
+ raise {NotImplementedError.__name__}
276
+ """
277
+ parts = test_module_content.split(test_class_declaration)
278
+ expected_parts = 2
279
+ if len(parts) > expected_parts:
280
+ msg = f"Found {len(parts)} parts, expected 2"
281
+ raise ValueError(msg)
282
+ parts.insert(1, test_class_content)
283
+ test_module_content = "".join(parts)
284
+
285
+ return test_module_content
286
+
287
+
288
+ def main() -> None:
289
+ """Entry point for the create_tests script.
290
+
291
+ Calls the create_tests function to generate all test files.
292
+ """
293
+ create_tests()
294
+
295
+
296
+ if __name__ == "__main__":
297
+ main()
@@ -1,28 +1,28 @@
1
- """Testing fixtures for pytest.
2
-
3
- This module provides custom fixtures for pytest that can be used to
4
- automate common testing tasks and provide consistent setup and teardown
5
- for tests.
6
- """
7
-
8
- import functools
9
-
10
- import pytest
11
-
12
- function_fixture = functools.partial(pytest.fixture, scope="function")
13
- class_fixture = functools.partial(pytest.fixture, scope="class")
14
- module_fixture = functools.partial(pytest.fixture, scope="module")
15
- package_fixture = functools.partial(pytest.fixture, scope="package")
16
- session_fixture = functools.partial(pytest.fixture, scope="session")
17
-
18
- autouse_function_fixture = functools.partial(
19
- pytest.fixture, scope="function", autouse=True
20
- )
21
- autouse_class_fixture = functools.partial(pytest.fixture, scope="class", autouse=True)
22
- autouse_module_fixture = functools.partial(pytest.fixture, scope="module", autouse=True)
23
- autouse_package_fixture = functools.partial(
24
- pytest.fixture, scope="package", autouse=True
25
- )
26
- autouse_session_fixture = functools.partial(
27
- pytest.fixture, scope="session", autouse=True
28
- )
1
+ """Testing fixtures for pytest.
2
+
3
+ This module provides custom fixtures for pytest that can be used to
4
+ automate common testing tasks and provide consistent setup and teardown
5
+ for tests.
6
+ """
7
+
8
+ import functools
9
+
10
+ import pytest
11
+
12
+ function_fixture = functools.partial(pytest.fixture, scope="function")
13
+ class_fixture = functools.partial(pytest.fixture, scope="class")
14
+ module_fixture = functools.partial(pytest.fixture, scope="module")
15
+ package_fixture = functools.partial(pytest.fixture, scope="package")
16
+ session_fixture = functools.partial(pytest.fixture, scope="session")
17
+
18
+ autouse_function_fixture = functools.partial(
19
+ pytest.fixture, scope="function", autouse=True
20
+ )
21
+ autouse_class_fixture = functools.partial(pytest.fixture, scope="class", autouse=True)
22
+ autouse_module_fixture = functools.partial(pytest.fixture, scope="module", autouse=True)
23
+ autouse_package_fixture = functools.partial(
24
+ pytest.fixture, scope="package", autouse=True
25
+ )
26
+ autouse_session_fixture = functools.partial(
27
+ pytest.fixture, scope="session", autouse=True
28
+ )
@@ -1 +1 @@
1
- """__init__ module for winipedia_utils.testing.tests.base.fixtures."""
1
+ """__init__ module for winipedia_utils.testing.tests.base.fixtures."""
@@ -1,6 +1,6 @@
1
- """Fixtures for testing.
2
-
3
- This module provides custom fixtures for pytest that can be used to
4
- automate common testing tasks and provide consistent setup and teardown
5
- for tests.
6
- """
1
+ """Fixtures for testing.
2
+
3
+ This module provides custom fixtures for pytest that can be used to
4
+ automate common testing tasks and provide consistent setup and teardown
5
+ for tests.
6
+ """