# Path: meta_package_manager/version.py
# ALNUM_EXTRACTOR = re.compile("(\\d+ | [a-z]+)", re.VERBOSE)
# class Token:
# class TokenizedString:
#     def __hash__(self):
#     def str_to_int(string):
#     def __init__(self, value):
#     def __repr__(self):
#     def __str__(self):
#     def __int__(self):
#     def isint(self):
#     def _match_type(self, other):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __gt__(self, other):
#     def __lt__(self, other):
#     def __ge__(self, other):
#     def __le__(self, other):
#     def __hash__(self):
#     def __new__(cls, value, *args, **kwargs):
#     def __init__(self, value, separator="-"):
#     def __repr__(self):
#     def __str__(self):
#     def pretty_print(self):
#     def tokenize(cls, string):
#     def __iter__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __gt__(self, other):
#     def __lt__(self, other):
#     def __ge__(self, other):
#     def __le__(self, other):


from random import shuffle
from ..version import Token, TokenizedString, parse_version
import pytest


@pytest.mark.parametrize(
    "value", (0, 123, -1, "0", "1.2.3", "abc", "A-B-C", "123   a bc \n")
)
def test_tokenized_string_allowed_instanciation(value):
    TokenizedString(value)


@pytest.mark.parametrize(
    "value", (None, 1.0, [1, 2, 3], (1, 2, 3), {1, 2, 3}, {"a": 1, "b": 2})
)
def test_tokenized_string_unauthorized_instanciation(value):
    with pytest.raises(TypeError):
        TokenizedString(value)


def test_tokenized_string_hash():
    assert hash(TokenizedString("1.2.3")) == hash(TokenizedString("1.2.3"))
    assert hash(TokenizedString(9999)) == hash(TokenizedString(9999))
    assert hash(TokenizedString("9999")) == hash(TokenizedString(9999))
    assert hash(TokenizedString("09999")) != hash(TokenizedString("9999"))
    assert hash(TokenizedString("09999")) != hash(TokenizedString(9999))
    assert hash(TokenizedString("1.2.3", separator=".")) != hash(
        TokenizedString("1.2.3", separator="_")
    )


def test_tokenized_string_idempotent_instanciation():
    tok1 = TokenizedString("1.2.3")

# Path: meta_package_manager/version.py
# ALNUM_EXTRACTOR = re.compile("(\\d+ | [a-z]+)", re.VERBOSE)
# class Token:
# class TokenizedString:
#     def __hash__(self):
#     def str_to_int(string):
#     def __init__(self, value):
#     def __repr__(self):
#     def __str__(self):
#     def __int__(self):
#     def isint(self):
#     def _match_type(self, other):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __gt__(self, other):
#     def __lt__(self, other):
#     def __ge__(self, other):
#     def __le__(self, other):
#     def __hash__(self):
#     def __new__(cls, value, *args, **kwargs):
#     def __init__(self, value, separator="-"):
#     def __repr__(self):
#     def __str__(self):
#     def pretty_print(self):
#     def tokenize(cls, string):
#     def __iter__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __gt__(self, other):
#     def __lt__(self, other):
#     def __ge__(self, other):
#     def __le__(self, other):


# Path: meta_package_manager/tests/test_version.py
from random import shuffle
from ..version import Token, TokenizedString, parse_version
import pytest



@pytest.mark.parametrize(
    "value", (0, 123, -1, "0", "1.2.3", "abc", "A-B-C", "123   a bc \n")
)
def test_tokenized_string_allowed_instanciation(value):
    TokenizedString(value)


@pytest.mark.parametrize(
    "value", (None, 1.0, [1, 2, 3], (1, 2, 3), {1, 2, 3}, {"a": 1, "b": 2})
)
def test_tokenized_string_unauthorized_instanciation(value):
    with pytest.raises(TypeError):
        TokenizedString(value)


def test_tokenized_string_hash():
    assert hash(TokenizedString("1.2.3")) == hash(TokenizedString("1.2.3"))
    assert hash(TokenizedString(9999)) == hash(TokenizedString(9999))
    assert hash(TokenizedString("9999")) == hash(TokenizedString(9999))
    assert hash(TokenizedString("09999")) != hash(TokenizedString("9999"))
    assert hash(TokenizedString("09999")) != hash(TokenizedString(9999))
    assert hash(TokenizedString("1.2.3", separator=".")) != hash(
        TokenizedString("1.2.3", separator="_")
    )


def test_tokenized_string_idempotent_instanciation():
    tok1 = TokenizedString("1.2.3")

    tok2 = TokenizedString(tok1)