+ nic_code = dash_split[0]
+ suite_id = dash_split[1].split(u".", 1)[0]
+ suite_tag = suite_id.rsplit(u"-", 1)[0]
+ for prefix in Constants.FORBIDDEN_SUITE_PREFIX_LIST:
+ if suite_tag.startswith(prefix):
+ suite_tag = suite_tag[len(prefix):]
+ return nic_code, suite_id, suite_tag
+
+
+def check_suite_tag(suite_tag, prolog):
+ """Verify suite tag occurres once in prolog.
+
+ Call this after all edits are done,
+ to confirm the (edited) suite tag still matches the (edited) suite name.
+
+ Currently, the edited suite tag is expect to be identical
+ to the primary suite tag, but having a function is more flexible.
+
+ The occurences are counted including "| " prefix,
+ to lower the chance to match a comment.
+
+ :param suite_tag: Part of suite name, between NIC driver and suite type.
+ :param prolog: The part of .robot file content without test cases.
+ :type suite_tag: str
+ :type prolog: str
+ :raises ValueError: If suite_tag not found exactly once.
+ """
+ found = prolog.count(u"| " + suite_tag)
+ if found != 1:
+ raise ValueError(f"Suite tag found {found} times for {suite_tag}")