add typing issues

This commit is contained in:
Benedikt Bartscher 2024-10-30 20:04:32 +01:00
parent 21cbcd6c30
commit 94de6a0a8d
No known key found for this signature in database

View File

@ -1,3 +1,5 @@
from typing import assert_type, reveal_type
import pytest
import reflex as rx
@ -85,3 +87,23 @@ def test_state_to_operation(type_: GenericType) -> None:
var = ObjectState.bare.to(ObjectVar)
assert var._var_type is type_
def test_typing() -> None:
# Bare
var = ObjectState.bare.to(ObjectVar)
reveal_type(var)
assert_type(var, ObjectVar[Bare])
var = ObjectState.base.to(ObjectVar, Base)
reveal_type(var)
assert_type(var, ObjectVar[Base])
# Base
var = ObjectState.base.to(ObjectVar)
reveal_type(var)
assert_type(var, ObjectVar[Base])
var = ObjectState.base.to(LiteralObjectVar, Base)
reveal_type(var)
assert_type(var, LiteralObjectVar[Base])