disnake icon indicating copy to clipboard operation
disnake copied to clipboard

Define reveal_type in tests at runtime

Open onerandomusername opened this issue 3 years ago • 2 comments

If anything we should define reveal_type in our tests and define it at runtime

Sounds like the best solution, let's do that then.

Originally posted by @shiftinv in https://github.com/DisnakeDev/disnake/pull/557#discussion_r913202529


This would be done by defining a reveal_type method in tests/helpers.py and importing it in each file that uses reveal_type. Ideally this would have the same arguments as pyright's reveal_type method, but most importantly, this should raise a RuntimeError if the function it called.

onerandomusername avatar Jul 04 '22 20:07 onerandomusername

typing.reveal_type was added in 3.11 (cpython commit), and was also backported to typing_extensions 4.1.0, which we could use as tests already depend on typing_extensions.

shiftinv avatar Jul 04 '22 20:07 shiftinv

typing.reveal_type was added in 3.11 (cpython commit), and was also backported to typing_extensions 4.1.0, which we could use as tests already depend on typing_extensions.

Unfortunately that won't entirely work as the typing.reveal_type method only takes a single argument.

onerandomusername avatar Jul 04 '22 20:07 onerandomusername