mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 02:00:46 +08:00
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>
This commit is contained in:
parent
47033f14ab
commit
95db646403
2 changed files with 64 additions and 36 deletions
18
tests/test_protocol_bucket_lang.py
Normal file
18
tests/test_protocol_bucket_lang.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue