Skip to content

Commit 1b29ba6

Browse files
isidore4dsherwoodnitsanavnisusanfungTegsy
committed
- f use the 3rd transform
Co-Authored-By: 4dsherwood <4dsherwood@users.noreply.github.com> Co-Authored-By: Nitsan Avni <nitsanav@gmail.com> Co-Authored-By: Susan Fung <38925660+susanfung@users.noreply.github.com> Co-Authored-By: T. E. Green <78671457+Tegsy@users.noreply.github.com>
1 parent db09ae6 commit 1b29ba6

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

TODO.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Test are running on all CI machine
22

33
Typing -> Talking -> Next
4-
Llewellyn
54
Teresa
65
Nitsan
76
Diana
87
Susan
8+
Llewellyn
99

1010
We're doing "ping pong style" rotation
1111
Rotate on each successful test run, after **any** smallest improvement to the code

approvaltests/inline/parse.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ def transform3(self, transform1: Callable[[str], T1], transform2: Callable[[str]
6464
def transformer(s: str) -> Tuple[T1, T2, int]:
6565
parts = s.split(",")
6666
parts = list(map(lambda p: p.strip(), parts))
67-
return (transform1(parts[0]), transform2(parts[1]), int(parts[2]))
67+
return (transform1(parts[0]), transform2(parts[1]), int1(parts[2]))
6868

6969
return Parse3(self.text, transformer, self.options)

approvaltests/inline/parse3.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Generic, Callable, Tuple, Any
22

3-
from approvaltests import verify_all, verify
3+
from approvaltests import verify_all
44
from approvaltests.inline.types import T1, T2, T3, NT1, NT2
55

66

tests/test_parse_inputs.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,12 @@ def test_with_3_parameters():
121121
"""
122122
a, 3, 1 -> aaaa
123123
"""
124+
125+
def to_int(s: str, t: type = str):
126+
assert type(s) is t
127+
return int(s)
128+
124129
parse = Parse.doc_string(auto_approve=True)
125-
parse.transform3(str, int, int).verify_all(lambda s, i1, i2: s * (i1 + i2))
130+
parse.transform3(str, int, int).verify_all(lambda s, i1, i2: s * (to_int(i1, int) + to_int(i2, int)))
131+
parse.transform3(str, str, str).verify_all(lambda s, i1, i2: s * (to_int(i1,) + to_int(i2)))
132+

0 commit comments

Comments
 (0)