Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

test(sofya): compare egress labels by value, not identity (#5031)

LearningCircuitd1b178fe684a
diff --git a/changelog.d/+sofya-egress-test-enum-equality.misc.md b/changelog.d/+sofya-egress-test-enum-equality.misc.md
new file mode 100644
index 0000000000..d90424a1f6
--- /dev/null
+++ b/changelog.d/+sofya-egress-test-enum-equality.misc.md
@@ -0,0 +1 @@
+The Sofya egress-labels test now compares enum members by `.value` instead of by identity. Under the Docker test setup the package is simultaneously available from `/app/src` (PYTHONPATH) and the installed wheel, so `SofyaSearchEngine`'s class attribute and the test's `Sensitivity` can resolve to distinct class objects with identical members. Python's `Enum.__eq__` returns `NotImplemented` across distinct classes (so `==` fails just like `is`); only `.value` (or `.name`) survives the dual-class scenario.
diff --git a/tests/web_search_engines/engines/test_search_engine_sofya.py b/tests/web_search_engines/engines/test_search_engine_sofya.py
index 25d21de155..0b13eb829a 100644
--- a/tests/web_search_engines/engines/test_search_engine_sofya.py
+++ b/tests/web_search_engines/engines/test_search_engine_sofya.py
@@ -521,5 +521,20 @@ class TestClassAttributes:
SofyaSearchEngine,
)
- assert SofyaSearchEngine.egress_sensitivity is Sensitivity.NON_SENSITIVE
- assert SofyaSearchEngine.egress_exposure is Exposure.EXPOSING
+ # Compare by .value, not by `is` or `==`. Under the Docker test
+ # setup the package is simultaneously available from /app/src
+ # (PYTHONPATH) and the installed wheel at /install/.venv, so
+ # SofyaSearchEngine's class attribute and the test's `Sensitivity`
+ # can resolve to distinct class objects with the same members.
+ # Python Enum semantics: `is` AND `==` both return False across
+ # distinct class objects; only `.value` (or `.name`) is robust.
+ # The sister test test_registered_engines_declare_consistent_labels
+ # uses `is` without flaking because it resolves the engine class
+ # through the registry's lazy import, which pins one module object.
+ assert (
+ SofyaSearchEngine.egress_sensitivity.value
+ == Sensitivity.NON_SENSITIVE.value
+ )
+ assert (
+ SofyaSearchEngine.egress_exposure.value == Exposure.EXPOSING.value
+ )