From 88c98ebc05c4d67bcdce7d3046ffa786f79b9284 Mon Sep 17 00:00:00 2001 From: tthijm <59415467+tthijm@users.noreply.github.com> Date: Wed, 12 Jun 2024 11:20:47 +0200 Subject: [PATCH] Add custom coverage test --- discord/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/discord/utils.py b/discord/utils.py index 99c7cfc94233..3f8f2a28f506 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -71,6 +71,7 @@ import typing import warnings import logging +from cov import test, mark import yarl @@ -1394,15 +1395,20 @@ def _to_kebab_case(text: str) -> str: return CAMEL_CASE_REGEX.sub('-', text).lower() +@test(4) def _human_join(seq: Sequence[str], /, *, delimiter: str = ', ', final: str = 'or') -> str: size = len(seq) if size == 0: + mark(0) return '' if size == 1: + mark(1) return seq[0] if size == 2: + mark(2) return f'{seq[0]} {final} {seq[1]}' + mark(3) return delimiter.join(seq[:-1]) + f' {final} {seq[-1]}'