Files
mono/market/tests/test_registry.py
giles 3809affcab Test dashboard: full menu system, all-service tests, filtering
- Run tests for all 10 services via per-service pytest subprocesses
- Group results by service with section headers
- Clickable summary cards filter by outcome (passed/failed/errors/skipped)
- Service filter nav using ~nav-link buttons in menu bar
- Full menu integration: ~header-row + ~header-child + ~menu-row
- Show logo image via cart-mini rendering
- Mount full service directories in docker-compose for test access
- Add 24 unit test files across 9 services

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 22:54:25 +00:00

59 lines
1.6 KiB
Python

"""Unit tests for product registry utilities."""
from __future__ import annotations
import pytest
from market.scrape.product.registry import merge_missing
class TestMergeMissing:
def test_fills_empty_dict(self):
dst = {}
merge_missing(dst, {"a": 1, "b": "hello"})
assert dst == {"a": 1, "b": "hello"}
def test_existing_value_not_overwritten(self):
dst = {"a": "original"}
merge_missing(dst, {"a": "new"})
assert dst["a"] == "original"
def test_none_overwritten(self):
dst = {"a": None}
merge_missing(dst, {"a": "filled"})
assert dst["a"] == "filled"
def test_empty_string_overwritten(self):
dst = {"a": ""}
merge_missing(dst, {"a": "filled"})
assert dst["a"] == "filled"
def test_empty_list_overwritten(self):
dst = {"a": []}
merge_missing(dst, {"a": [1, 2]})
assert dst["a"] == [1, 2]
def test_empty_dict_overwritten(self):
dst = {"a": {}}
merge_missing(dst, {"a": {"key": "val"}})
assert dst["a"] == {"key": "val"}
def test_zero_not_overwritten(self):
dst = {"a": 0}
merge_missing(dst, {"a": 42})
assert dst["a"] == 0
def test_false_not_overwritten(self):
dst = {"a": False}
merge_missing(dst, {"a": True})
assert dst["a"] is False
def test_none_src(self):
dst = {"a": 1}
merge_missing(dst, None)
assert dst == {"a": 1}
def test_new_keys_added(self):
dst = {"a": 1}
merge_missing(dst, {"b": 2})
assert dst == {"a": 1, "b": 2}