mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 06:40:45 +08:00
Share protocol classification helpers and return en labels for diagnostics when lang=en. Co-authored-by: Cursor <cursoragent@cursor.com>
18 lines
761 B
Python
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()
|