11Any markers and ellipses
22=========================
33
4- Let's look at how the Ellipsis marker (`... `) works in mockito.
4+ Let's look at how the Ellipsis marker (`` ... ` `) works in mockito.
55
66Assume:
77
1717
1818 when(C).function(...)
1919
20- The sole `... ` denotes a "whatever" matcher.
20+ The sole `` ... ` ` denotes a "whatever" matcher.
2121
2222These are allowed:
2323
@@ -39,7 +39,7 @@ When configured as:
3939
4040 when(C).function(2, ...)
4141
42- The trailing `... ` denotes a rest matcher. We match up to the `2 `; the rest is accepted.
42+ The trailing `` ... ` ` denotes a rest matcher. We match up to the `2 `; the rest is accepted.
4343
4444::
4545
@@ -67,10 +67,10 @@ Allows:
6767 function(1, 2, three=3)
6868
6969
70- Fixed-position ellipsis (` ... `) as `any `
70+ Relation to `any `
7171----------------------------------------
7272
73- `... ` can also be used in a fixed position as an ad-hoc `any ` matcher.
73+ `` ... ` ` can also be used in a fixed position as an ad-hoc `any ` matcher.
7474
7575Assume:
7676
@@ -149,12 +149,13 @@ With that configuration, naturally follows::
149149Relation to `*args `
150150-------------------
151151
152- If you want to match `*args ` (multiple arguments), use `args `:
152+ If you want to match `*args ` (multiple arguments), use `` args ` `:
153153
154154::
155155
156156 def sum(*args): ...
157157
158+ from mockito import args
158159 when(C).sum(1, 2, *args)
159160
160161Allows:
@@ -164,14 +165,15 @@ Allows:
164165 sum(1, 2, 3)
165166 sum(1, 2, 3, 4)
166167
167- That is similar to plain trailing `... `, but `args ` also composes with keyword arguments.
168+ That is similar to plain trailing `` ... `` , but `` args ` ` also composes with keyword arguments.
168169
169170Assume:
170171
171172::
172173
173174 def sum(*args, init=0): ...
174175
176+ from mockito import args
175177 when(C).sum(1, 2, *args, init=5)
176178
177179Allows:
187189
188190 when(C).sum(1, 2, ..., init=5)
189191
190- uses fixed-position `... ` (one value), so it allows:
192+ uses fixed-position `` ... ` ` (one value), so it allows:
191193
192194::
193195
@@ -210,10 +212,11 @@ Ideally we could write:
210212
211213 when(C).fetch("https://example.com/", retry=..., ...)
212214
213- but that's not valid Python syntax. Use `kwargs ` instead:
215+ but that's not valid Python syntax. Use `` kwargs ` ` instead:
214216
215217::
216218
219+ from mockito import kwargs
217220 when(C).fetch("https://example.com/", retry=..., **kwargs)
218221
219222Allows:
226229
227230::
228231
232+ from mockito import kwargs
229233 when(C).fetch(..., retry=2, **kwargs)
230234
231235Allows:
@@ -236,5 +240,5 @@ Allows:
236240 fetch("https://foobar.com/", retry=2)
237241 fetch("https://foobar.com/", retry=2, headers={})
238242
239- Use `kwargs ` as the rest marker where `... ` is not syntactically available
243+ Use `` kwargs `` as the rest marker where `` ... ` ` is not syntactically available
240244because specific keyword arguments are already configured.
0 commit comments