First implementation of bindings

This commit is contained in:
2025-11-09 19:23:18 +01:00
parent b5c1c15198
commit 86dfff812b
51 changed files with 5971 additions and 1080 deletions

View File

@@ -7,7 +7,7 @@ from fasthtml.fastapp import fast_app
import myfasthtml.auth.utils
from myfasthtml.auth.routes import setup_auth_routes
from myfasthtml.auth.utils import create_auth_beforeware, register_user
from myfasthtml.core.testclient import MyTestClient
from myfasthtml.test.testclient import MyTestClient
@dataclass

View File

@@ -2,7 +2,9 @@ import pytest
from fasthtml.fastapp import fast_app
from myfasthtml.auth.utils import create_auth_beforeware
from myfasthtml.core.testclient import MyTestClient
from myfasthtml.core.utils import quoted_str
from myfasthtml.test.testclient import MyTestClient
def test_non_protected_route():
app, rt = fast_app()
@@ -31,3 +33,15 @@ def test_all_routes_are_protected():
user.open("/")
user.should_see("Sign In")
@pytest.mark.parametrize("actual,expected", [
("string", '"string"'),
("string with 'single quotes'", '''"string with 'single quotes'"'''),
('string with "double quotes"', """'string with "double quotes"'"""),
("""string with 'single' and "double" quotes""", '''"string with 'single' and \\"double\\" quotes"'''),
(None, "None"),
(123, "123"),
])
def test_i_can_quote_str(actual, expected):
assert quoted_str(actual) == expected