-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30bf9ec
commit e2a944c
Showing
4 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pytest | ||
from pycrdt import Array, Doc, Map | ||
|
||
|
||
@pytest.mark.mypy_testing | ||
def mypy_test_array(): | ||
doc = Doc() | ||
array0: Array[int] = doc.get("array0", type=Array) | ||
array0.append(0) | ||
array0.append("foo") # E: Argument 1 to "append" of "Array" has incompatible type "str"; expected "int" [arg-type] | ||
|
||
|
||
@pytest.mark.mypy_testing | ||
def mypy_test_map(): | ||
doc = Doc() | ||
map0: Map[bool] = doc.get("map0", type=Map) | ||
map0["foo"] = True | ||
map0["foo"] = "bar" # E: Incompatible types in assignment (expression has type "str", target has type "bool") | ||
v0: str = map0.pop("foo") # E: Incompatible types in assignment (expression has type "bool", variable has type "str") | ||
v1: bool = map0.pop("foo") |