瀏覽代碼

try to fix pytests

Falko Schindler 1 年之前
父節點
當前提交
8fdb504673
共有 2 個文件被更改,包括 8 次插入3 次删除
  1. 3 1
      nicegui/observables.py
  2. 5 2
      tests/test_observables.py

+ 3 - 1
nicegui/observables.py

@@ -1,4 +1,6 @@
-from typing import Any, Callable, Dict, Iterable, List, Set, SupportsIndex, Union, overload
+from typing import Any, Callable, Dict, Iterable, List, Set, Union, overload
+
+from typing_extensions import SupportsIndex
 
 
 class ObservableDict(dict):

+ 5 - 2
tests/test_observables.py

@@ -1,3 +1,5 @@
+import sys
+
 from nicegui.observables import make_observable
 
 count = 0
@@ -30,8 +32,9 @@ def test_observable_dict():
     assert count == 6
     data.setdefault('a', 1)
     assert count == 7
-    data |= {'b': 2}
-    assert count == 8
+    if sys.version_info >= (3, 9):
+        data |= {'b': 2}
+        assert count == 8
 
 
 def test_observable_list():