approval-utilities 11.0.0__tar.gz → 11.1.1__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.0.0/approval_utilities.egg-info → approval_utilities-11.1.1}/PKG-INFO +1 -1
- {approval_utilities-11.0.0 → approval_utilities-11.1.1/approval_utilities.egg-info}/PKG-INFO +1 -1
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities.egg-info/SOURCES.txt +1 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_combinations.py +10 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_inline_approvals.py +20 -0
- approval_utilities-11.1.1/tests/test_parse_inputs.py +84 -0
- approval_utilities-11.1.1/version.py +1 -0
- approval_utilities-11.0.0/version.py +0 -1
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/LICENSE +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/MANIFEST.in +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/README.md +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/__init__.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/approvaltests/__init__.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/approvaltests/core/__init__.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/approvaltests/core/executable_command.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/approvaltests/core/verifiable.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/approvaltests/core/verify_parameters.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/list_utils.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/__init__.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/clipboard_utilities.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/deprecated.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/exceptions/__init__.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/exceptions/exception_collector.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/exceptions/exception_utils.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/exceptions/multiple_exceptions.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/logger/__init__.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/logger/logging_instance.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/logger/simple_logger.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/map_reduce.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/markdown_table.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/multiline_string_utils.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/os_utilities.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/persistence/__init__.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/persistence/loader.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/persistence/saver.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/stack_frame_utilities.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/string_wrapper.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/time_utilities.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/wrapper.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities/utils.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities.egg-info/dependency_links.txt +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/approval_utilities.egg-info/top_level.txt +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/requirements.prod.extras.txt +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/requirements.prod.required.txt +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/requirements.prod.txt +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/setup.cfg +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/setup.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/setup_utils.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_asserts.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_custom_printers.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_example_numpy.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_exception_utils.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_fileapprover.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_list.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_multiline_string_utils.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_namer.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_options.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_pairwise_combinations.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_python_patterns.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_scenarios.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_simple_logger.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_split_code.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_verify.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_verify_all.py +0 -0
- {approval_utilities-11.0.0 → approval_utilities-11.1.1}/tests/test_writer.py +0 -0
|
@@ -4,6 +4,7 @@ from approvaltests.approval_exception import ApprovalException
|
|
|
4
4
|
from approvaltests.combination_approvals import (
|
|
5
5
|
verify_all_combinations,
|
|
6
6
|
verify_all_combinations_with_namer,
|
|
7
|
+
verify_all_combinations_with_labeled_input,
|
|
7
8
|
)
|
|
8
9
|
from approvaltests.reporters import CommandLineReporter
|
|
9
10
|
from approvaltests.reporters.testing_reporter import ReporterForTesting
|
|
@@ -121,6 +122,15 @@ class VerifyAllCombinationsTests(unittest.TestCase):
|
|
|
121
122
|
reporter=self.reporter,
|
|
122
123
|
)
|
|
123
124
|
|
|
125
|
+
def test_with_labeled_input(self) -> None:
|
|
126
|
+
# begin-snippet: named_combinations
|
|
127
|
+
verify_all_combinations_with_labeled_input(
|
|
128
|
+
self.func,
|
|
129
|
+
arg1=(1, 3),
|
|
130
|
+
arg2=(2, 4),
|
|
131
|
+
)
|
|
132
|
+
# end-snippet
|
|
133
|
+
|
|
124
134
|
|
|
125
135
|
class VerifyAllCombinationsWithNamerTests(unittest.TestCase):
|
|
126
136
|
def setUp(self) -> None:
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import unittest
|
|
1
2
|
from inspect import FrameInfo
|
|
2
3
|
from pathlib import Path
|
|
3
4
|
from typing import Callable, Any
|
|
4
5
|
|
|
5
6
|
from approval_utilities.utilities.clipboard_utilities import copy_to_clipboard
|
|
6
7
|
from approval_utilities.utilities.multiline_string_utils import remove_indentation_from
|
|
8
|
+
from approval_utilities.utilities.stack_frame_utilities import get_class_name_for_frame
|
|
7
9
|
from approvaltests import (
|
|
8
10
|
StackFrameNamer,
|
|
9
11
|
assert_equal_with_reporter,
|
|
@@ -11,8 +13,10 @@ from approvaltests import (
|
|
|
11
13
|
Reporter,
|
|
12
14
|
verify,
|
|
13
15
|
verify_all,
|
|
16
|
+
verify_all_combinations_with_labeled_input,
|
|
14
17
|
)
|
|
15
18
|
from approvaltests.inline.parse_docstring import parse_docstring
|
|
19
|
+
from approvaltests.namer.inline_comparator import InlineComparator
|
|
16
20
|
from approvaltests.reporters import MultiReporter
|
|
17
21
|
|
|
18
22
|
|
|
@@ -118,3 +122,19 @@ def test_uppercase():
|
|
|
118
122
|
"\n".join([f"{a} -> {a.upper()}" for a in parse_docstring()]),
|
|
119
123
|
options=Options().inline(),
|
|
120
124
|
)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class InlineTests(unittest.TestCase):
|
|
128
|
+
def test_with_labeled_input_inline(self) -> None:
|
|
129
|
+
"""
|
|
130
|
+
(arg1: 1, arg2: 2) => 3
|
|
131
|
+
(arg1: 1, arg2: 4) => 5
|
|
132
|
+
(arg1: 3, arg2: 2) => 5
|
|
133
|
+
(arg1: 3, arg2: 4) => 7
|
|
134
|
+
"""
|
|
135
|
+
verify_all_combinations_with_labeled_input(
|
|
136
|
+
lambda a, b: a + b,
|
|
137
|
+
arg1=(1, 3),
|
|
138
|
+
arg2=(2, 4),
|
|
139
|
+
options=Options().inline(show_code=False),
|
|
140
|
+
)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
from typing import List, Callable, Any
|
|
2
|
+
|
|
3
|
+
from approvaltests import Options, verify_all
|
|
4
|
+
from approvaltests.namer.inline_comparator import InlineComparator
|
|
5
|
+
|
|
6
|
+
from typing import TypeVar, Generic
|
|
7
|
+
|
|
8
|
+
from build.lib.approvaltests.reporters import ReporterThatAutomaticallyApproves
|
|
9
|
+
|
|
10
|
+
T = TypeVar("T")
|
|
11
|
+
T2 = TypeVar("T2")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Parse(Generic[T]):
|
|
15
|
+
def __init__(self, text: str, transformer: Callable[[str], T]) -> None:
|
|
16
|
+
self.text = text
|
|
17
|
+
self._transformer = transformer
|
|
18
|
+
|
|
19
|
+
@staticmethod
|
|
20
|
+
def doc_string() -> "Parse[str]":
|
|
21
|
+
return Parse(InlineComparator.get_test_method_doc_string(), lambda s: s)
|
|
22
|
+
|
|
23
|
+
def get_inputs(self) -> List[T]:
|
|
24
|
+
lines = self.text.split("\n")
|
|
25
|
+
lines = list(filter(lambda line: line.strip(), lines))
|
|
26
|
+
inputs = [line.split("->")[0].strip() for line in lines]
|
|
27
|
+
return [self._transformer(i) for i in inputs]
|
|
28
|
+
|
|
29
|
+
def verify_all(self, transform: Callable[[T], Any]):
|
|
30
|
+
verify_all(
|
|
31
|
+
"",
|
|
32
|
+
self.get_inputs(),
|
|
33
|
+
lambda s: f"{s} -> {transform(s)}",
|
|
34
|
+
options=Options().inline(),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
def transform(self, transform: Callable[[T], T2]) -> "Parse[T2]":
|
|
38
|
+
return Parse(self.text, lambda s: transform(self._transformer(s)))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def test_single_strings():
|
|
42
|
+
"""
|
|
43
|
+
Sam -> SAM
|
|
44
|
+
Llewellyn -> LLEWELLYN
|
|
45
|
+
"""
|
|
46
|
+
parse = Parse.doc_string()
|
|
47
|
+
verify_all(
|
|
48
|
+
"",
|
|
49
|
+
parse.get_inputs(),
|
|
50
|
+
lambda s: f"{s} -> {s.upper()}",
|
|
51
|
+
options=Options().inline(),
|
|
52
|
+
)
|
|
53
|
+
parse.verify_all(lambda s: s.upper())
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def test_with_types_transformers_and_both():
|
|
57
|
+
"""
|
|
58
|
+
1 -> 0b1
|
|
59
|
+
9 -> 0b1001
|
|
60
|
+
"""
|
|
61
|
+
parse = Parse.doc_string()
|
|
62
|
+
verify_all(
|
|
63
|
+
"",
|
|
64
|
+
parse.get_inputs(),
|
|
65
|
+
lambda s: f"{s} -> {bin(int(s))}",
|
|
66
|
+
options=Options().inline(),
|
|
67
|
+
)
|
|
68
|
+
parse.transform(int).verify_all(lambda i: bin(i))
|
|
69
|
+
parse.transform(lambda a: int(a)).verify_all(lambda i: bin(i))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
# parse.transform(int).transform(str).transform(int).verify_all(lambda i: bin(i), options= Options().with_reporter(ReporterThatAutomaticallyApproves())
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def test_with_2_types_transformers_and_both():
|
|
76
|
+
"""
|
|
77
|
+
1, 2.2 -> 2.2
|
|
78
|
+
4, 0.5 -> 2
|
|
79
|
+
"""
|
|
80
|
+
s = "2.2"
|
|
81
|
+
parse = Parse.doc_string()
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
# parse.transform2(int, float).verify_all(lambda i,f: i * f)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version_number = "v11.1.1"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
version_number = "v11.0.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{approval_utilities-11.0.0 → approval_utilities-11.1.1}/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.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{approval_utilities-11.0.0 → approval_utilities-11.1.1}/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.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/map_reduce.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{approval_utilities-11.0.0 → approval_utilities-11.1.1}/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.0.0 → approval_utilities-11.1.1}/approval_utilities/utilities/wrapper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{approval_utilities-11.0.0 → approval_utilities-11.1.1}/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
|
{approval_utilities-11.0.0 → approval_utilities-11.1.1}/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
|
|
File without changes
|