# Path: chirp/library/order.py
# _NUMBERING_RE = re.compile(r"^\s*(-?\d+)([^\d\-]+(-?\d+))?\s*$", re.UNICODE)
# _ARCHIVAL_RE = re.compile(r"^\d+/\d+$", re.UNICODE)
# class BadOrderError(Exception):
# def decode(text):
# def encode(order_num, total_num):
# def standardize_str(text):
# def _is_order_tag(tag):
# def standardize(tag):
# def is_archival(text):
# def verify_and_standardize_str_list(text_list):
# def verify_and_standardize(tag_list):


import unittest
import mutagen.id3
from chirp.library import order
            self.assertEqual((order_num, max_num), order.decode(text))
        # These should not be parseable.
        error_test_cases = ("", "xxx", "0", "-1", "0/3", "3/", "3/0", "6/5",
                            "-1/4", "2/-1", "2/-", "3-4", "3/0")
        for text in error_test_cases:
            self.assertRaises(order.BadOrderError, order.decode, text)

    def test_encode(self):
        test_cases = ((1, 3, "1/3"), (7, None, "7"))
        for order_num, total_num, expected_text in test_cases:
            self.assertEqual(expected_text, order.encode(order_num, total_num))
        error_test_cases = ((7, 5), (0, 3), (-1, 3), (4, 0), (4, -1))
        for order_num, total_num in error_test_cases:
            self.assertRaises(order.BadOrderError,
                              order.encode, order_num, total_num)

    def test_standardize_str(self):
        self.assertEqual("3", order.standardize_str(" 3   "))
        self.assertEqual("3/7", order.standardize_str("3 of 7"))

    def test_standardize(self):
        tag = mutagen.id3.TRCK(text=["3 of 7"])
        order_num, max_num = order.standardize(tag)
        self.assertEqual(["3/7"], tag.text)
        self.assertEqual(3, order_num)
        self.assertEqual(7, max_num)

    def test_is_archival(self):
        self.assertTrue(order.is_archival("3/7"))
        self.assertFalse(order.is_archival("bad"))

# Path: chirp/library/order.py
# _NUMBERING_RE = re.compile(r"^\s*(-?\d+)([^\d\-]+(-?\d+))?\s*$", re.UNICODE)
# _ARCHIVAL_RE = re.compile(r"^\d+/\d+$", re.UNICODE)
# class BadOrderError(Exception):
# def decode(text):
# def encode(order_num, total_num):
# def standardize_str(text):
# def _is_order_tag(tag):
# def standardize(tag):
# def is_archival(text):
# def verify_and_standardize_str_list(text_list):
# def verify_and_standardize(tag_list):


# Path: chirp/library/order_test.py
import unittest
import mutagen.id3
from chirp.library import order

            self.assertEqual((order_num, max_num), order.decode(text))
        # These should not be parseable.
        error_test_cases = ("", "xxx", "0", "-1", "0/3", "3/", "3/0", "6/5",
                            "-1/4", "2/-1", "2/-", "3-4", "3/0")
        for text in error_test_cases:
            self.assertRaises(order.BadOrderError, order.decode, text)

    def test_encode(self):
        test_cases = ((1, 3, "1/3"), (7, None, "7"))
        for order_num, total_num, expected_text in test_cases:
            self.assertEqual(expected_text, order.encode(order_num, total_num))
        error_test_cases = ((7, 5), (0, 3), (-1, 3), (4, 0), (4, -1))
        for order_num, total_num in error_test_cases:
            self.assertRaises(order.BadOrderError,
                              order.encode, order_num, total_num)

    def test_standardize_str(self):
        self.assertEqual("3", order.standardize_str(" 3   "))
        self.assertEqual("3/7", order.standardize_str("3 of 7"))

    def test_standardize(self):
        tag = mutagen.id3.TRCK(text=["3 of 7"])
        order_num, max_num = order.standardize(tag)
        self.assertEqual(["3/7"], tag.text)
        self.assertEqual(3, order_num)
        self.assertEqual(7, max_num)

    def test_is_archival(self):
        self.assertTrue(order.is_archival("3/7"))
        self.assertFalse(order.is_archival("bad"))

        self.assertFalse(order.is_archival("3"))