Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
Add custom coverage test
Browse files Browse the repository at this point in the history
  • Loading branch information
tthijm committed Jun 12, 2024
1 parent 824a293 commit 2afde74
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions discord/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
import typing
import warnings
import logging
from cov import test, mark

import yarl

Expand Down Expand Up @@ -1084,14 +1085,18 @@ def as_chunks(iterator: _Iter[T], max_size: int) -> _Iter[List[T]]:
PY_312 = sys.version_info >= (3, 12)


@test(3)
def flatten_literal_params(parameters: Iterable[Any]) -> Tuple[Any, ...]:
params = []
literal_cls = type(Literal[0])
for p in parameters:
if isinstance(p, literal_cls):
mark(1)
params.extend(p.__args__)
else:
mark(2)
params.append(p)
mark(0)
return tuple(params)


Expand Down

0 comments on commit 2afde74

Please sign in to comment.