Skip to content

Commit 1e7bfb7

Browse files
committed
Added pragma: no cover to untested bits of DataLoader (minor stuff)
1 parent 32ab879 commit 1e7bfb7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

graphene/utils/dataloader.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,21 @@ def __init__(
4444
), "batch_load_fn must be coroutine. Received: {}".format(self.batch_load_fn)
4545

4646
if not callable(self.batch_load_fn):
47-
raise TypeError(
47+
raise TypeError( # pragma: no cover
4848
(
4949
"DataLoader must be have a batch_load_fn which accepts "
5050
"Iterable<key> and returns Future<Iterable<value>>, but got: {}."
5151
).format(batch_load_fn)
5252
)
5353

5454
if batch is not None:
55-
self.batch = batch
55+
self.batch = batch # pragma: no cover
5656

5757
if max_batch_size is not None:
5858
self.max_batch_size = max_batch_size
5959

6060
if cache is not None:
61-
self.cache = cache
61+
self.cache = cache # pragma: no cover
6262

6363
self.get_cache_key = get_cache_key or (lambda x: x)
6464

@@ -77,7 +77,7 @@ def load(self, key=None):
7777
Loads a key, returning a `Future` for the value represented by that key.
7878
"""
7979
if key is None:
80-
raise TypeError(
80+
raise TypeError( # pragma: no cover
8181
(
8282
"The loader.load() function must be called with a value, "
8383
"but got: {}."
@@ -113,7 +113,7 @@ def do_resolve_reject(self, key, future):
113113
enqueue_post_future_job(self.loop, self)
114114
else:
115115
# Otherwise dispatch the (queue of one) immediately.
116-
dispatch_queue(self)
116+
dispatch_queue(self) # pragma: no cover
117117

118118
def load_many(self, keys):
119119
"""
@@ -129,7 +129,7 @@ def load_many(self, keys):
129129
>>> )
130130
"""
131131
if not isinstance(keys, Iterable):
132-
raise TypeError(
132+
raise TypeError( # pragma: no cover
133133
(
134134
"The loader.load_many() function must be called with Iterable<key> "
135135
"but got: {}."
@@ -223,7 +223,7 @@ async def dispatch_queue_batch(loader, queue):
223223

224224
# Assert the expected response from batch_load_fn
225225
if not batch_future or not iscoroutine(batch_future):
226-
return failed_dispatch(
226+
return failed_dispatch( # pragma: no cover
227227
loader,
228228
queue,
229229
TypeError(
@@ -238,7 +238,7 @@ async def dispatch_queue_batch(loader, queue):
238238
try:
239239
values = await batch_future
240240
if not isinstance(values, Iterable):
241-
raise TypeError(
241+
raise TypeError( # pragma: no cover
242242
(
243243
"DataLoader must be constructed with a function which accepts "
244244
"Iterable<key> and returns Future<Iterable<value>>, but the function did "
@@ -248,7 +248,7 @@ async def dispatch_queue_batch(loader, queue):
248248

249249
values = list(values)
250250
if len(values) != len(keys):
251-
raise TypeError(
251+
raise TypeError( # pragma: no cover
252252
(
253253
"DataLoader must be constructed with a function which accepts "
254254
"Iterable<key> and returns Future<Iterable<value>>, but the function did "

0 commit comments

Comments
 (0)