Rodja Trappe 2 anos atrás
pai
commit
b30060d1c1
3 arquivos alterados com 3 adições e 7 exclusões
  1. 0 1
      nicegui/app.py
  2. 0 2
      nicegui/globals.py
  3. 3 4
      tests/test_storage.py

+ 0 - 1
nicegui/app.py

@@ -2,7 +2,6 @@ from typing import Awaitable, Callable, Union
 
 from fastapi import FastAPI
 from fastapi.staticfiles import StaticFiles
-from pyparsing import Optional
 
 from . import globals
 from .native import Native

+ 0 - 2
nicegui/globals.py

@@ -5,7 +5,6 @@ from contextlib import contextmanager
 from enum import Enum
 from typing import TYPE_CHECKING, Any, Awaitable, Callable, Dict, List, Optional, Union
 
-from fastapi import Request
 from socketio import AsyncServer
 from uvicorn import Server
 
@@ -46,7 +45,6 @@ socket_io_js_extra_headers: Dict = {}
 
 _socket_id: Optional[str] = None
 slot_stacks: Dict[int, List['Slot']] = {}
-requests: Dict[str, Request] = {}
 clients: Dict[str, 'Client'] = {}
 index_client: 'Client'
 

+ 3 - 4
tests/test_storage.py

@@ -1,5 +1,4 @@
 import asyncio
-from uuid import uuid4
 
 from nicegui import Client, app, ui
 
@@ -10,7 +9,7 @@ def test_browser_data_is_stored_in_the_browser(screen: Screen):
     @ui.page('/')
     def page():
         app.storage.browser['count'] = app.storage.browser.get('count', 0) + 1
-        ui.label(app.storage.browser['count'] or 'no session')
+        ui.label().bind_text_from(app.storage.browser, 'count')
 
     @app.get('/count')
     def count():
@@ -31,7 +30,7 @@ def test_browser_storage_supports_asyncio(screen: Screen):
     async def page():
         app.storage.browser['count'] = app.storage.browser.get('count', 0) + 1
         await asyncio.sleep(0.5)
-        ui.label(app.storage.browser['count'] or 'no session')
+        ui.label(app.storage.browser['count'])
 
     screen.open('/')
     screen.switch_to(1)
@@ -61,7 +60,7 @@ def test_individual_storage_modifications(screen: Screen):
         if delayed:
             await client.connected()
         app.storage.individual['count'] = app.storage.individual.get('count', 0) + 1
-        ui.label(app.storage.individual['count'] or 'no session')
+        ui.label().bind_text_from(app.storage.individual, 'count')
 
     screen.open('/')
     screen.should_contain('1')