aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py (unfollow)
Commit message (Collapse)AuthorLines
2022-01-09Converters: use datetime.timezone instead of dateutil.tzGravatar MarkKoz-3/+2
They're equivalent for UTC. Get rid of the extra import.
2021-09-21TalentPool: fix typo in error messageGravatar MarkKoz-2/+2
2021-09-21Time: fix format_with_duration's 2nd arg's defaultGravatar MarkKoz-0/+3
It wasn't passing the current time when `other_timestamp` was None.
2021-08-23Time: put region comments around overloadsGravatar MarkKoz-0/+2
2021-08-07Time: check timestamp for None only rather than if it's falsyGravatar MarkKoz-4/+4
Integers and floats which are 0 are considered valid timestamps, but are falsy.
2021-08-07Time: return strings from until_expiration instead of ambiguous NoneGravatar MarkKoz-10/+9
None was returned for two separate cases: permanent infractions and expired infractions. This resulted in an ambiguity.
2021-08-07Fix create_user_embed testsGravatar MarkKoz-0/+9
Mock User.created_at and User.joined_at because `arrow.get()` doesn't work with Mock objects. The old implementation of `time.discord_timestamp` accepted mocks because it just did `int()` on any type it didn't explicitly check for.
2021-08-06Time: use typing.Literal for precision param of humanize_deltaGravatar MarkKoz-5/+6
2021-08-06Time: add overload to pass relativedelta kwargs to humanize_deltaGravatar MarkKoz-4/+32
2021-08-06Time: add overload to pass 2 timestamps to humanize_deltaGravatar MarkKoz-30/+105
Remove the need for the caller to create a `relativedelta` from 2 timestamps before calling `humanize_delta`. This is especially convenient for cases where the original inputs aren't `datetime`s since `relativedelta` only accepts those.
2021-08-05Time: remove DISCORD_TIMESTAMP_REGEXGravatar MarkKoz-11/+6
There's a saner way to parse the timestamp that relied on this regex.
2021-08-05Time: support more timestamp formats as argumentsGravatar MarkKoz-73/+63
Remove the burden of conversion from the caller to clean up and simplify the call sites. Handle timestamp conversions internally with arrow.get. Remove format_infraction and get_time_delta because they're now obsolete. Replace the former with discord_timestamp and the latter with format_relative.
2021-08-05Time: rename format_infraction_with_durationGravatar MarkKoz-22/+22
It's not necessarily tied to infractions anymore.
2021-08-05Time: remove timedelta and relativedelta support from discord_timestampGravatar MarkKoz-5/+1
When a delta is given, it is unknown what it's relative to. The function has to assume it's relative to the POSIX Epoch. However, using a delta for this would be quite odd, and would more likely be a mistake if anything. relativedelta support was broken anyway since it wasn't using the total seconds represented by the delta.
2021-08-05Time: remove broken enum type check in discord_timestampGravatar MarkKoz-3/+0
First, the `args` attribute doesn't exist on enums. Even if it did, this check only works if the argument given is an enum member (of any enum). Such occurrence seems too rare to warrant an explicit check.
2021-08-05Time: remove absolute param from format_infraction_with_durationGravatar MarkKoz-8/+1
It's not used anywhere. Furthermore, a humanised duration with negative values wouldn't make sense.
2021-08-05Time: replace discord_timestamp calls with format_relativeGravatar MarkKoz-6/+6
Use the latter where the former was being called with the relative format type.
2021-08-05Time: rename time_since to format_relativeGravatar MarkKoz-8/+13
While the function is basically just a wrapper for discord_timestamp now, it is very common to use the relative format. It's cumbersome to import the format enum and pass it to discord_timestamp calls, so keeping this function around will be nice.
2021-08-05Time: qualify uses of functions with the module nameGravatar MarkKoz-58/+51
In cases where many time utility functions were being imported, this makes the imports shorter and cleaner. In other cases, the function names read better when they're qualified with "time"; the extra context it adds is helpful.
2021-08-05Time: remove RFC1123 supportGravatar MarkKoz-13/+0
It's not used anywhere and hasn't been for a very long time.
2022-01-08Fix snekbox tests with new allowed_mentionsGravatar Ben Soyka-4/+20
2022-01-08Restrict allowed mentions for !eval resultsGravatar Ben Soyka-2/+3
2022-01-04modlog: wait for guild init before using channel cacheGravatar Kronifer-0/+3
Not doing so could cause an error where get_channel would return none for the mod logs channel.
2022-01-01Infraction mod-log improvementsGravatar Izan-4/+5
- Add infraction id to infraction edit modlog - Add missing colon in "infraction applied" message - Utilise defined infraction id variable instead of indexing dict again
2021-12-29Add text indicating when user fetched by message (#2013)Gravatar TizzySaurus-16/+18
Co-authored-by: Xithrius <[email protected]>