MCPcopy
hub / github.com/JerBouma/FinanceDatabase / test_exchange_mic_one_to_one

Function test_exchange_mic_one_to_one

tests/test_equities.py:272–284  ·  view source on GitHub ↗

Each `exchange` code must map to exactly one `mic`. Mirrors `test_exchange_market_one_to_one`: a single exchange code resolving to multiple MICs signals drift in the exchange-to-MIC mapping.

()

Source from the content-addressed store, hash-verified

270
271
272def test_exchange_mic_one_to_one() -> None:
273 """Each `exchange` code must map to exactly one `mic`.
274
275 Mirrors `test_exchange_market_one_to_one`: a single exchange code resolving
276 to multiple MICs signals drift in the exchange-to-MIC mapping.
277 """
278 df = equities.select()
279 pairs = df.dropna(subset=["exchange", "mic"])
280 by_exchange = pairs.groupby("exchange")["mic"].nunique()
281 ambiguous = by_exchange[by_exchange > 1]
282 assert (
283 ambiguous.empty
284 ), f"Exchange codes mapping to multiple MICs: {ambiguous.to_dict()}"
285
286
287def test_mic_filled_when_exchange_mapped() -> None:

Callers

nothing calls this directly

Calls 1

selectMethod · 0.45

Tested by

no test coverage detected