Skip to content

Commit 55488d7

Browse files
author
Sylvain MARIE
committed
Fixed two doctests in the docstring
1 parent d337129 commit 55488d7

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

pytest_cases/case_funcs_legacy.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def test_target(target # type: Any
7474
A simple decorator to declare that a case function is associated with a particular target.
7575
7676
>>> @test_target(int)
77-
>>> def case_to_test_int():
78-
>>> ...
77+
... def case_to_test_int():
78+
... pass
7979
8080
This is actually an alias for `@case_tags(target)`, that some users may find a bit more readable.
8181
@@ -122,11 +122,11 @@ def cases_generator(names=None, # type: Union[str, Callable[[Any], str
122122
parameters will be passed to the decorated function.
123123
124124
>>> @cases_generator("test with i={i}", i=range(10))
125-
>>> def case_10_times(i):
126-
>>> ''' Generates 10 cases '''
127-
>>> ins = dict(a=i, b=i+1)
128-
>>> outs = i+1, i+2
129-
>>> return ins, outs, None
125+
... def case_10_times(i):
126+
... ''' Generates 10 cases '''
127+
... ins = dict(a=i, b=i+1)
128+
... outs = i+1, i+2
129+
... return ins, outs, None
130130
131131
:param names: a name template, that will be transformed into the case name using
132132
`names.format(**params)` for each case, where `params` is the dictionary of parameter values for this

pytest_cases/common_others.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,18 @@ def qname(func):
269269

270270
# if sys.version_info > (3, ):
271271
def funcopy(f):
272+
"""
273+
274+
>>> def foo():
275+
... return 1
276+
>>> foo.att = 2
277+
>>> f = funcopy(foo)
278+
>>> f.att
279+
2
280+
>>> f()
281+
1
282+
283+
"""
272284
# see https://stackoverflow.com/a/6527746/7262247
273285
# and https://stackoverflow.com/a/13503277/7262247
274286
# apparently it is not possible to create an actual copy with copy() !

0 commit comments

Comments
 (0)