Skip to content

Commit

Permalink
pytest: doctest warned in transform.regex.capture
Browse files Browse the repository at this point in the history
  • Loading branch information
Juarez Rudsatz committed Feb 18, 2022
1 parent ba84f0b commit 8321a2f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions petl/transform/regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def capture(table, field, pattern, newfields=None, include_original=False,
... ['2', 'A2', '15'],
... ['3', 'B1', '18'],
... ['4', 'C12', '19']]
>>> table2 = etl.capture(table1, 'variable', '(\\w)(\\d+)',
>>> table2 = etl.capture(table1, 'variable', '([A-Z,a-z]+)([0-9]+)',
... ['treat', 'time'])
>>> table2
+-----+-------+-------+------+
Expand All @@ -40,7 +40,7 @@ def capture(table, field, pattern, newfields=None, include_original=False,
+-----+-------+-------+------+
>>> # using the include_original argument
... table3 = etl.capture(table1, 'variable', '(\\w)(\\d+)',
... table3 = etl.capture(table1, 'variable', '([A-Z,a-z]+)([0-9]+)',
... ['treat', 'time'],
... include_original=True)
>>> table3
Expand All @@ -65,7 +65,6 @@ def capture(table, field, pattern, newfields=None, include_original=False,
expression. If ``fill`` is ``None`` (default) then a
``petl.transform.TransformError`` will be raised on the first non-matching
value.
"""

return CaptureView(table, field, pattern,
Expand Down Expand Up @@ -457,4 +456,3 @@ def itersplitdown(table, field, pattern, maxsplit, flags):
value = row[field_index]
for v in prog.split(value, maxsplit):
yield tuple(v if i == field_index else row[i] for i in range(len(hdr)))

0 comments on commit 8321a2f

Please sign in to comment.