Files
wehub-resource-sync 7a0da7932b
Backwards Compatibility / Verify Encryption Constants (push) Waiting to run
Backwards Compatibility / PyPI Version Compatibility (push) Waiting to run
Backwards Compatibility / Database Migration Tests (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-form] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-metrics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-workflow] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [history-news] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [library] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [link-analytics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [mobile] (push) Blocked by required conditions
Docker Tests (Consolidated) / detect-changes (push) Waiting to run
Docker Tests (Consolidated) / Build Test Image (push) Waiting to run
Docker Tests (Consolidated) / All Pytest Tests + Coverage (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [accessibility] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [api-crud] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-login] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-register] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-lifecycle] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [error-benchmark] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) (push) Blocked by required conditions
Docker Tests (Consolidated) / Accessibility Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Unit Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Example Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / Production Image Smoke Test (push) Blocked by required conditions
Docker Tests (Consolidated) / Infrastructure Tests (push) Blocked by required conditions
OSSF Scorecard / OSSF Security Scorecard Analysis (push) Waiting to run
OSV-Scanner (Scheduled) / scan-scheduled (push) Failing after 0s
Create Release / test-gate (push) Has been cancelled
Create Release / release-gate (push) Has been cancelled
Create Release / ci-gate (push) Has been cancelled
Create Release / version-check (push) Has been cancelled
Create Release / e2e-test-gate (push) Has been cancelled
Create Release / responsive-test-gate (push) Has been cancelled
Create Release / compat-test-gate (push) Has been cancelled
Create Release / compose-integration-gate (push) Has been cancelled
Create Release / vulture-gate (push) Has been cancelled
Create Release / build (push) Has been cancelled
Create Release / provenance (push) Has been cancelled
Create Release / prerelease-docker (push) Has been cancelled
Create Release / publish-docker (push) Has been cancelled
Create Release / create-release (push) Has been cancelled
Create Release / cleanup-changelog (push) Has been cancelled
Create Release / trigger-pypi (push) Has been cancelled
Create Release / monitor-pypi (push) Has been cancelled
Create Release / Clean up orphan prerelease tags and signatures (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:08:55 +08:00

64 lines
2.3 KiB
Python

"""Edge-case tests for _parse_number() and _parse_multiselect().
These cover branches missed by existing test_parse_multiselect.py and
test_manager_behavior.py: scientific notation, ValueError paths,
JSON-to-non-list parsing, and degenerate input strings.
"""
import pytest
from local_deep_research.settings.manager import (
_parse_multiselect,
_parse_number,
)
class TestParseNumberEdgeCases:
"""Edge cases for _parse_number()."""
def test_scientific_notation_whole_returns_int(self):
"""1e2 = 100.0 which is_integer() → returns int(100)."""
assert _parse_number("1e2") == 100
assert isinstance(_parse_number("1e2"), int)
def test_scientific_notation_whole_float_returns_int(self):
"""1.5e2 = 150.0 which is_integer() is True → returns int(150)."""
result = _parse_number("1.5e2")
# 150.0.is_integer() is True so this returns int
assert result == 150
assert isinstance(result, int)
def test_negative_whole_returns_int(self):
assert _parse_number("-5.0") == -5
assert isinstance(_parse_number("-5.0"), int)
def test_non_numeric_raises_valueerror(self):
with pytest.raises(ValueError):
_parse_number("abc")
class TestParseMultiselectEdgeCases:
"""Edge cases not covered by test_parse_multiselect.py."""
def test_json_parses_to_dict_falls_to_comma_split(self):
"""JSON that parses to a dict (not list) falls through to comma split."""
result = _parse_multiselect('{"a": 1}')
# JSON parses OK but isinstance(parsed, list) is False
# Falls through to comma-separated split
assert isinstance(result, list)
assert result == ['{"a": 1}']
def test_only_commas_returns_empty_list(self):
"""String of only commas → all items strip to empty → filtered out."""
result = _parse_multiselect(",,,")
assert result == []
def test_non_string_non_list_passthrough_none(self):
"""None should pass through unchanged."""
assert _parse_multiselect(None) is None
def test_whitespace_only_string(self):
"""Whitespace-only string: stripped → doesn't start with '[' → comma split → empty."""
result = _parse_multiselect(" ")
assert result == []