approval-utilities 11.2.1__tar.gz → 12.1.0__tar.gz
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 approval-utilities might be problematic. Click here for more details.
- {approval_utilities-11.2.1/approval_utilities.egg-info → approval_utilities-12.1.0}/PKG-INFO +1 -1
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/README.md +1 -1
- {approval_utilities-11.2.1 → approval_utilities-12.1.0/approval_utilities.egg-info}/PKG-INFO +1 -1
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_inline_approvals.py +19 -28
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_options.py +32 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_parse_inputs.py +28 -0
- approval_utilities-12.1.0/version.py +1 -0
- approval_utilities-11.2.1/version.py +0 -1
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/LICENSE +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/MANIFEST.in +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/__init__.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/approvaltests/__init__.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/approvaltests/core/__init__.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/approvaltests/core/executable_command.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/approvaltests/core/verifiable.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/approvaltests/core/verify_parameters.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/list_utils.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/__init__.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/clipboard_utilities.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/deprecated.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/exceptions/__init__.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/exceptions/exception_collector.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/exceptions/exception_utils.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/exceptions/multiple_exceptions.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/logger/__init__.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/logger/logging_instance.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/logger/simple_logger.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/map_reduce.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/markdown_table.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/multiline_string_utils.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/os_utilities.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/persistence/__init__.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/persistence/loader.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/persistence/saver.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/stack_frame_utilities.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/string_wrapper.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/time_utilities.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/wrapper.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utils.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities.egg-info/SOURCES.txt +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities.egg-info/dependency_links.txt +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities.egg-info/top_level.txt +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/requirements.prod.extras.txt +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/requirements.prod.required.txt +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/requirements.prod.txt +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/setup.cfg +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/setup.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/setup_utils.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_asserts.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_combinations.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_custom_printers.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_example_numpy.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_exception_utils.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_fileapprover.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_list.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_multiline_string_utils.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_namer.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_pairwise_combinations.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_python_patterns.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_scenarios.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_simple_logger.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_split_code.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_verify.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_verify_all.py +0 -0
- {approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_writer.py +0 -0
|
@@ -50,7 +50,7 @@ utilities.
|
|
|
50
50
|
|
|
51
51
|
### What Are Approvals
|
|
52
52
|
|
|
53
|
-
If you need to gain a better understanding or are new to this concept, start [here](
|
|
53
|
+
If you need to gain a better understanding or are new to this concept, start [here](https://github.com/approvals/ApprovalTests.Documentation/blob/main/explanations/what_are_approvals.md).
|
|
54
54
|
|
|
55
55
|
### New Projects
|
|
56
56
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import unittest
|
|
2
2
|
from inspect import FrameInfo
|
|
3
|
-
from pathlib import Path
|
|
4
3
|
from typing import Callable, Any
|
|
5
4
|
|
|
6
5
|
import pytest
|
|
7
6
|
|
|
8
|
-
from approval_utilities.utilities.clipboard_utilities import copy_to_clipboard
|
|
9
7
|
from approval_utilities.utilities.multiline_string_utils import remove_indentation_from
|
|
10
8
|
from approvaltests import (
|
|
11
9
|
StackFrameNamer,
|
|
12
|
-
assert_equal_with_reporter,
|
|
13
10
|
Options,
|
|
14
|
-
Reporter,
|
|
15
11
|
verify,
|
|
16
12
|
verify_all,
|
|
17
13
|
verify_all_combinations_with_labeled_input,
|
|
18
14
|
ApprovalException,
|
|
19
15
|
)
|
|
16
|
+
from approvaltests.inline.inline_options import InlineOptions
|
|
20
17
|
from approvaltests.inline.parse_docstring import parse_docstring
|
|
21
|
-
from approvaltests.reporters import MultiReporter, ReportWithBeyondCompare
|
|
22
18
|
from approvaltests.reporters.report_quietly import ReportQuietly
|
|
19
|
+
from build.lib.approvaltests.reporters.report_with_beyond_compare import (
|
|
20
|
+
ReportWithPycharm,
|
|
21
|
+
ReportWithBeyondCompare,
|
|
22
|
+
)
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
def get_approved_via_doc_string():
|
|
@@ -76,30 +76,13 @@ def test_docstrings():
|
|
|
76
76
|
"""
|
|
77
77
|
# verify_inline(greetting())
|
|
78
78
|
# verify(greetting(), options=Options().inline(show_code= False))
|
|
79
|
-
verify(greeting(), options=Options().inline(
|
|
79
|
+
verify(greeting(), options=Options().inline())
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
def greeting():
|
|
83
83
|
return "hello\nworld"
|
|
84
84
|
|
|
85
85
|
|
|
86
|
-
class InlineReporter(Reporter):
|
|
87
|
-
# TODO: Start here - Make this report create a temp file of the fixed source,
|
|
88
|
-
# and compare it with the existing source.
|
|
89
|
-
# if there are mulitple failures, they each get there on reporter
|
|
90
|
-
def report(self, received_path: str, approved_path: str) -> bool:
|
|
91
|
-
received = Path(received_path).read_text()
|
|
92
|
-
copy_to_clipboard(f"'''\n{received}\n'''")
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
def verify_inline(actual):
|
|
96
|
-
options = Options()
|
|
97
|
-
options = options.with_reporter(MultiReporter(options.reporter, InlineReporter()))
|
|
98
|
-
if actual[-1] != "\n":
|
|
99
|
-
actual += "\n"
|
|
100
|
-
assert_equal_with_reporter(get_approved_via_doc_string(), actual, options=options)
|
|
101
|
-
|
|
102
|
-
|
|
103
86
|
def test_docstring_parsing():
|
|
104
87
|
"""
|
|
105
88
|
1
|
|
@@ -157,7 +140,7 @@ class InlineTests(unittest.TestCase):
|
|
|
157
140
|
lambda a, b: a + b,
|
|
158
141
|
arg1=(1, 3),
|
|
159
142
|
arg2=(2, 4),
|
|
160
|
-
options=Options().inline(
|
|
143
|
+
options=Options().inline(),
|
|
161
144
|
)
|
|
162
145
|
|
|
163
146
|
|
|
@@ -170,7 +153,7 @@ def test_preceding_whitespace():
|
|
|
170
153
|
"""
|
|
171
154
|
4 whitespaces
|
|
172
155
|
"""
|
|
173
|
-
verify(get_preceding_whitespace(), options=Options().inline(
|
|
156
|
+
verify(get_preceding_whitespace(), options=Options().inline())
|
|
174
157
|
|
|
175
158
|
|
|
176
159
|
def test_trailing_whitespace():
|
|
@@ -179,7 +162,7 @@ def test_trailing_whitespace():
|
|
|
179
162
|
"""
|
|
180
163
|
# Note: Pycharm will remove the trailing whitespaces, to disable this go to:
|
|
181
164
|
# File -> Settings -> Editor -> General -> On Save -> [ ] Remove trailing spaces
|
|
182
|
-
verify("4 trailing whitespaces ", options=Options().inline(
|
|
165
|
+
verify("4 trailing whitespaces ", options=Options().inline())
|
|
183
166
|
|
|
184
167
|
# fmt: on
|
|
185
168
|
|
|
@@ -192,8 +175,16 @@ def test_bug_blank_lines():
|
|
|
192
175
|
|
|
193
176
|
|
|
194
177
|
|
|
178
|
+
"""
|
|
179
|
+
verify("\n\ntest bug with blank lines\n\n\n\n", options=Options().inline())
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def test_inline_with_additional_reporter():
|
|
183
|
+
"""
|
|
184
|
+
hello
|
|
185
|
+
world
|
|
195
186
|
"""
|
|
196
187
|
verify(
|
|
197
|
-
"\
|
|
198
|
-
options=Options().inline(
|
|
188
|
+
"hello\nworld",
|
|
189
|
+
options=(Options().inline().add_reporter(ReportWithBeyondCompare())),
|
|
199
190
|
)
|
|
@@ -9,6 +9,8 @@ from approvaltests import (
|
|
|
9
9
|
)
|
|
10
10
|
from approvaltests.core.options import Options
|
|
11
11
|
from approvaltests.mrjob import mrjob_approvals
|
|
12
|
+
from approvaltests.reporters import ReportByCreatingDiffFile, MultiReporter
|
|
13
|
+
from approvaltests.reporters.report_with_beyond_compare import ReportWithPycharm
|
|
12
14
|
from approvaltests.utilities import command_line_approvals
|
|
13
15
|
from approvaltests.utilities.logger import simple_logger_approvals
|
|
14
16
|
|
|
@@ -66,3 +68,33 @@ def test_file_extensions():
|
|
|
66
68
|
verify(content, options=Options().for_file.with_extension(".md"))
|
|
67
69
|
# end-snippet
|
|
68
70
|
verify(content, options=Options().for_file.with_extension("md"))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_add_reporter():
|
|
74
|
+
# current behaviour, override
|
|
75
|
+
options0 = (
|
|
76
|
+
Options()
|
|
77
|
+
.with_reporter(ReportByCreatingDiffFile())
|
|
78
|
+
.with_reporter(ReportWithPycharm())
|
|
79
|
+
)
|
|
80
|
+
assert type(options0.reporter) == ReportWithPycharm
|
|
81
|
+
|
|
82
|
+
# current work around, create a MultiReporter
|
|
83
|
+
options_multi = Options().with_reporter(
|
|
84
|
+
MultiReporter(ReportByCreatingDiffFile(), ReportWithPycharm())
|
|
85
|
+
)
|
|
86
|
+
assert (
|
|
87
|
+
str(options_multi.reporter)
|
|
88
|
+
== "MultiReporter(ReportByCreatingDiffFile, ReportWithPycharm)"
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
# new behaviour, append
|
|
92
|
+
options0 = (
|
|
93
|
+
Options()
|
|
94
|
+
.with_reporter(ReportByCreatingDiffFile())
|
|
95
|
+
.add_reporter(ReportWithPycharm())
|
|
96
|
+
)
|
|
97
|
+
assert (
|
|
98
|
+
str(options_multi.reporter)
|
|
99
|
+
== "MultiReporter(ReportByCreatingDiffFile, ReportWithPycharm)"
|
|
100
|
+
)
|
|
@@ -115,3 +115,31 @@ def test_with_two_parameters():
|
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
# end-snippet
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
# long-term intention: get the test to fail, randomSauce is incorrect
|
|
121
|
+
def test_with_3_parameters():
|
|
122
|
+
"""
|
|
123
|
+
a, 3, 1 -> aaaa
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
counter = 0
|
|
127
|
+
|
|
128
|
+
def to(tin: type, tout: type):
|
|
129
|
+
def wrapped(input):
|
|
130
|
+
nonlocal counter
|
|
131
|
+
counter += 1
|
|
132
|
+
assert type(input) is tin
|
|
133
|
+
return tout(input)
|
|
134
|
+
|
|
135
|
+
return wrapped
|
|
136
|
+
|
|
137
|
+
parse = Parse.doc_string(auto_approve=True)
|
|
138
|
+
parse.transform3(to(str, str), to(str, str), to(str, str)).transform3(
|
|
139
|
+
to(str, str), to(str, int), to(str, int)
|
|
140
|
+
).verify_all(lambda a, b, c: to(str, str)(a) * (to(int, int)(b) + to(int, int)(c)))
|
|
141
|
+
|
|
142
|
+
assert counter == 9
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# assert on all the paramaters
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version_number = "v12.1.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
version_number = "v11.2.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/approvaltests/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/deprecated.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/map_reduce.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/os_utilities.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities/utilities/wrapper.py
RENAMED
|
File without changes
|
|
File without changes
|
{approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{approval_utilities-11.2.1 → approval_utilities-12.1.0}/approval_utilities.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{approval_utilities-11.2.1 → approval_utilities-12.1.0}/tests/test_multiline_string_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|