broker-sync/tests/providers/test_trading212_ticker.py

28 lines
800 B
Python
Raw Normal View History

from __future__ import annotations
import pytest
from broker_sync.providers.trading212 import _normalise_ticker
@pytest.mark.parametrize(
("raw", "expected"),
[
# T212 LSE suffix: lowercase "l" before _EQ means London listing.
("VUAGl_EQ", "VUAG"),
("VUSAl_EQ", "VUSA"),
("VWRPl_EQ", "VWRP"),
("METAl_EQ", "META"),
# T212 US suffix: _US_EQ means US listing. Strip the whole suffix.
("META_US_EQ", "META"),
("AAPL_US_EQ", "AAPL"),
# Plain _EQ suffix with no exchange letter.
("FOO_EQ", "FOO"),
# Already canonical — passes through.
("VUAG", "VUAG"),
("META", "META"),
],
)
def test_normalise_ticker(raw: str, expected: str) -> None:
assert _normalise_ticker(raw) == expected