Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

fix(tests): wire the suites and recognizers the merged branch left behind

Nandakishora6af7f383999
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c97db629..c97f733d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -150,6 +150,7 @@ jobs:
python tests/test_temperature_loading.py
python tests/test_confidence.py
python tests/test_cli.py
+ python tests/test_cli_lang_guess.py
python tests/test_mcp.py
python tests/test_mcp_device.py
python tests/test_langchain.py
diff --git a/tests/test_agent_gate.py b/tests/test_agent_gate.py
index fbe256aa..33f862fe 100644
--- a/tests/test_agent_gate.py
+++ b/tests/test_agent_gate.py
@@ -20,6 +20,10 @@ if "torch" not in sys.modules:
t = types.ModuleType("torch")
t.cuda = types.ModuleType("torch.cuda")
t.cuda.OutOfMemoryError = type("OutOfMemoryError", (RuntimeError,), {})
+ # laya/common.py annotates `proper_reward` with both at module scope, so importing
+ # laya.agent through this stub needs them present even though no test touches a tensor.
+ t.Tensor = type("Tensor", (), {})
+ t.dtype = type("dtype", (), {})
t.nn = types.ModuleType("torch.nn")
t.nn.Module = type("Module", (), {})
t.nn.MultiheadAttention = type("MultiheadAttention", (), {})
diff --git a/tests/test_cli.py b/tests/test_cli.py
index efcaed5c..ae15a909 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -697,12 +697,12 @@ code, out, err, stub = run_cli(["--predict", "--model", "english", "--task", "mu
check("drift: every control the parser names a flag for arrives in the call",
all(control in stub.kwargs for control in (PREDICT_CONTROLS & NAMED)),
"missing %s" % sorted((PREDICT_CONTROLS & NAMED) - set(stub.kwargs)))
-# `lang_guess` is the weaker form of a flag the CLI already has, and both are call-level, so
-# `--lang` dominates it for a command line; `hooks_raise` / `hooks_timeout` govern hooks, and
-# `make_router` installs none, so there is nothing in this process for them to change.
-check("drift: the controls with no flag are exactly the accepted six",
+# `lang_guess` has had its own flag since #795, so what is left is the hook arguments:
+# `hooks_raise` / `hooks_timeout` govern hooks and `make_router` installs none, so there is
+# nothing in this process for them to change, and the three callables cannot come off a shell.
+check("drift: the controls with no flag are exactly the accepted five",
sorted(PREDICT_CONTROLS - NAMED)
- == ["hooks", "hooks_raise", "hooks_timeout", "lang_guess",
+ == ["hooks", "hooks_raise", "hooks_timeout",
"on_predict_end", "on_predict_start"],
sorted(PREDICT_CONTROLS - NAMED))
diff --git a/tests/test_compose_env.py b/tests/test_compose_env.py
index 5f1e27a8..a3152016 100644
--- a/tests/test_compose_env.py
+++ b/tests/test_compose_env.py
@@ -94,7 +94,8 @@ EMPTY_OR = 'os.environ.get("{name}") or '
# A resolver that returns its own default from the empty string: the read, then a falsy test on
# the next line, then the value it hands back. Only the first two lines are looked at, so a
# reader that ignores an empty value and keeps going is still reported.
-EMPTY_RESOLVER = (r'os\.environ\.get\("{name}"(,\s*""\s*)?\)\s*\n\s*if not \w+\b')
+EMPTY_RESOLVER = (r'os\.environ\.get\("{name}"(,\s*""\s*)?\)\s*\n'
+ r'\s*if (not \w+|\w+ is None or not \w+)\b')
def empty_unsafe_reads(name: str) -> List[str]: