def test_duplicate_symbol(empty_msgid_store: MessageIdStore) -> None: empty_msgid_store.add_msgid_and_symbol("W1234", "warning-symbol") with pytest.raises(InvalidMessageError) as error: empty_msgid_store.check_msgid_and_symbol("W1234", "other-symbol") assert ( "Message id 'W1234' cannot have both 'other-symbol' and 'warning-symbol' as symbolic name." in str(error.value))
def test_duplicate_msgid(msgid_store: MessageIdStore) -> None: msgid_store.add_msgid_and_symbol("W1234", "warning-symbol") with pytest.raises(InvalidMessageError) as error: msgid_store.check_msgid_and_symbol("W1235", "warning-symbol") assert ( "Message symbol 'warning-symbol' cannot be used for 'W1234' and 'W1235'" in str(error.value))
def test_add_msgid_and_symbol(empty_msgid_store: MessageIdStore) -> None: empty_msgid_store.add_msgid_and_symbol("E1235", "new-sckiil") empty_msgid_store.add_legacy_msgid_and_symbol("C1235", "old-sckiil", "E1235") assert len(empty_msgid_store) == 2 message_ids = empty_msgid_store.get_active_msgids("E1235") assert len(message_ids) == 1 assert message_ids[0] == "E1235" message_ids = empty_msgid_store.get_active_msgids("old-sckiil") assert len(message_ids) == 1 assert message_ids[0] == "E1235" assert empty_msgid_store.get_symbol("C1235") == "old-sckiil" assert empty_msgid_store.get_symbol("E1235") == "new-sckiil" assert empty_msgid_store.get_msgid("old-sckiil") == "C1235" assert empty_msgid_store.get_msgid("new-sckiil") == "E1235" with pytest.raises(UnknownMessageError): empty_msgid_store.get_symbol("C1234") with pytest.raises(UnknownMessageError): empty_msgid_store.get_msgid("not-exist")