reflex/reflex/utils
Masen Furer 356deb5457
[REF-3589] raise EventHandlerArgMismatch when event handler args don't match spec (#3853)
* test_component: improve valid/invalid event trigger tests

Add test cases for event triggers defined as annotations.

Add additional cases around lambda returning different values.

Improve assertions for invalid tests (each line needs its own `pytest.raises`).

More invalid test cases.

* [REF-3589] raise EventHandlerArgMismatch when event handler args don't match spec

Improve error message for common issue.

Previously when the event handler arguments didn't match the spec, the
traceback resulted in:

```
OSError: could not get source code
```

Now this problem is traceable as a distinct error condition and users are
empowered to debug their code and reference the documentation (to be updated)
for further information.

* raise EventFnArgMismatch when lambda args don't match event trigger spec

Improve error message for another common issue encountered in the reflex framework.

Previous error message was

```
TypeError: index.<locals>.<lambda>() takes 0 positional arguments but 1 was given
```

* Fix up lambda test cases

* call_event_fn: adjust number of args for bound methods
2024-08-29 16:05:15 -07:00
..
__init__.py [REF-99] Add first version of CLI for hosting service (#1810) 2023-10-21 13:09:56 -07:00
build.py Make .web configurable with REFLEX_WEB_WORKDIR (#3462) 2024-06-17 16:17:00 -04:00
codespaces.py Add a link to backend in connection error (#3044) 2024-06-27 12:20:03 -07:00
compat.py [REF-3266] Check for pydantic v1 outside of try/except (#3643) 2024-07-10 12:28:39 -07:00
console.py dedupe config overrides (#3600) 2024-07-03 17:34:22 +02:00
exceptions.py [REF-3589] raise EventHandlerArgMismatch when event handler args don't match spec (#3853) 2024-08-29 16:05:15 -07:00
exec.py Make .web configurable with REFLEX_WEB_WORKDIR (#3462) 2024-06-17 16:17:00 -04:00
export.py upgrade to latest ruff (#3497) 2024-06-19 12:32:13 +02:00
format.py fully migrate vars into new system (#3743) 2024-08-26 13:28:18 -07:00
imports.py [REF-3228] implement LiteralStringVar and format/retrieval mechanism (#3669) 2024-07-17 17:01:27 -07:00
lazy_loader.py upgrade to latest ruff (#3497) 2024-06-19 12:32:13 +02:00
net.py [REF-3633] [main] Introduce a workaround for enterprise users who get stuck with httpx.get SSL (#3847) 2024-08-28 09:33:31 -07:00
path_ops.py Make .web configurable with REFLEX_WEB_WORKDIR (#3462) 2024-06-17 16:17:00 -04:00
prerequisites.py [REF-3633] [main] Introduce a workaround for enterprise users who get stuck with httpx.get SSL (#3847) 2024-08-28 09:33:31 -07:00
processes.py migrate deprecated connections to net_connections (#3641) 2024-07-11 11:21:34 -07:00
pyi_generator.py fully migrate vars into new system (#3743) 2024-08-26 13:28:18 -07:00
redir.py reflex init --ai fixups (#3691) 2024-07-19 14:05:53 -07:00
registry.py use different registry when in china, fixes #3700 (#3702) 2024-08-12 03:06:34 -07:00
serializers.py upgrade to latest ruff (#3497) 2024-06-19 12:32:13 +02:00
telemetry.py Suppress runtime warnings (#3354) 2024-05-21 12:34:25 -07:00
types.py Get attribute access type fix (#3803) 2024-08-29 09:45:24 -07:00
watch.py Make .web configurable with REFLEX_WEB_WORKDIR (#3462) 2024-06-17 16:17:00 -04:00