netx/tests/test_protocol_bucket_lang.py
oliver 95db646403 feat(ume): English protocol bucket labels via lang query param
Share protocol classification helpers and return en labels for diagnostics when lang=en.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 23:35:47 +08:00

18 lines
761 B
Python

import unittest
from netx_api.main import _classify_protocol_bucket, _protocol_bucket_label
class ProtocolBucketLangTests(unittest.TestCase):
def test_english_labels(self) -> None:
blob = "BGP VPN OTN CLOCK POWER misc"
self.assertEqual(_protocol_bucket_label(blob, lang="en"), "IP/MPLS")
self.assertEqual(_classify_protocol_bucket("OTN ODU"), "OTN/Optical")
self.assertEqual(_protocol_bucket_label("OTN ODU", lang="en"), "OTN/Optical")
self.assertEqual(_protocol_bucket_label("OTN ODU", lang="zh"), "OTN/光")
self.assertEqual(_protocol_bucket_label("misc", lang="en"), "Other")
self.assertEqual(_protocol_bucket_label("misc", lang="zh"), "其他")
if __name__ == "__main__":
unittest.main()