test: Fix mypy strict errors in test tree
The test tree needs to be aligned with type checking, too, because jw-pkg is going to required it for test, too. The load_yaml and StringTree tests receive their fixtures as bare Callable and Generator without type arguments, and the StringTree tests pass the st fixture without an annotation. The cast script suppresses errors with un-coded type ignore comments, and the parse_opts script declares its loop variable as "str | int", so indexing the Options object with it is rejected. Introduce _YamlFile, _TempDir, and _St aliases for the fixture types and give the st parameters an annotation. Code the type ignore comments with the argument mismatch they suppress, and split the parse_opts loop variable into i for the index loops and k for the key loops. Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1 Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
63c0ed3951
commit
7885f69b44
1 changed files with 156 additions and 151 deletions
|
|
@ -1,8 +1,6 @@
|
|||
from jw.util.log import NOTICE, slog
|
||||
from jw.util.Options import Options
|
||||
|
||||
i: str | int
|
||||
|
||||
delim = "======================= "
|
||||
d = "----------------------- "
|
||||
|
||||
|
|
@ -15,8 +13,8 @@ slog(NOTICE, d + "by index")
|
|||
for i in range(0, 4):
|
||||
slog(NOTICE, "attr({}) = {}".format(i, a.get(i, by_index = True, default = False)))
|
||||
slog(NOTICE, d + "by key")
|
||||
for i in ["this", "that", "b", "a", "doit"]:
|
||||
slog(NOTICE, "attr({}) = {}".format(i, a[i]))
|
||||
for k in ["this", "that", "b", "a", "doit"]:
|
||||
slog(NOTICE, "attr({}) = {}".format(k, a[k]))
|
||||
|
||||
s = '"me": "too", "Pfalse": true, "myarr": ["a", "b", "c"], "me": "not"'
|
||||
slog(NOTICE, delim + s)
|
||||
|
|
@ -27,8 +25,8 @@ slog(NOTICE, d + "by index")
|
|||
for i in range(0, 5):
|
||||
slog(NOTICE, "attr({}) = {}".format(i, a.get(i, by_index = True, default = False)))
|
||||
slog(NOTICE, d + "by key in keys()")
|
||||
for i in a.keys():
|
||||
slog(NOTICE, "attr({}) = {}".format(i, a[i]))
|
||||
for k in a.keys():
|
||||
slog(NOTICE, "attr({}) = {}".format(k, a[k]))
|
||||
slog(NOTICE, d + "by key")
|
||||
for i in ["me", "Pfalse", "myarr"]:
|
||||
slog(NOTICE, "attr({}) = {}".format(i, a[i]))
|
||||
for k in ["me", "Pfalse", "myarr"]:
|
||||
slog(NOTICE, "attr({}) = {}".format(k, a[k]))
|
||||
|
|
|
|||
Loading…
Reference in a new issue