# Path: pisi/version.py
# class Version(object):
# 
#     __slots__ = ("__version", "__version_string")
# 
#     @staticmethod
#     def valid(version):
#         try:
#             make_version(version)
#         except InvalidVersionError:
#             return False
#         return True
# 
#     def __init__(self, verstring):
#         self.__version_string = verstring
#         self.__version = make_version(verstring)
# 
#     def string(self):
#         return self.__version_string
# 
#     def compare(self, ver):
#         if isinstance(ver, basestring):
#             return cmp(self.__version, make_version(ver))
# 
#         return cmp(self.__version, ver.__version)
# 
#     def __lt__(self, rhs):
#         if isinstance(rhs, basestring):
#             return self.__version < make_version(rhs)
# 
#         return self.__version < rhs.__version
# 
#     def __le__(self, rhs):
#         if isinstance(rhs, basestring):
#             return self.__version <= make_version(rhs)
# 
#         return self.__version <= rhs.__version
# 
#     def __gt__(self, rhs):
#         if isinstance(rhs, basestring):
#             return self.__version > make_version(rhs)
# 
#         return self.__version > rhs.__version
# 
#     def __ge__(self, rhs):
#         if isinstance(rhs, basestring):
#             return self.__version >= make_version(rhs)
# 
#         return self.__version >= rhs.__version
# 
#     def __eq__(self, rhs):
#         if isinstance(rhs, basestring):
#             return self.__version_string == rhs
# 
#         return self.__version_string == rhs.__version_string
# 
#     def __str__(self):
#         return self.__version_string


import unittest
from pisi.version import Version
        self.assert_(v5 > v3)

    def testOpsKeywords(self):
        # with keywords
        v1 = Version("2.23_pre10")
        v2 = Version("2.23")
        v3 = Version("2.21")
        v4 = Version("2.23_p1")
        v5 = Version("2.23_beta1")
        v6 = Version("2.23_m1")
        v7 = Version("2.23_rc1")
        v8 = Version("2.23_rc2")
        self.assert_(v1 < v2)
        self.assert_(v1 > v3)
        self.assert_(v1 < v4)
        self.assert_(v1 > v5)
        self.assert_(v2 < v4)
        self.assert_(v2 > v5)
        self.assert_(v6 < v4)
        self.assert_(v6 > v5)
        self.assert_(v7 > v5)
        self.assert_(v8 > v7)

        v1 = Version("1.0_alpha1")
        v2 = Version("1.0_alpha2")
        self.assert_(v2 > v1)

    def testOpsCharacters(self):
        # with character
        v1 = Version("2.10a")

# Path: pisi/version.py
# class Version(object):
# 
#     __slots__ = ("__version", "__version_string")
# 
#     @staticmethod
#     def valid(version):
#         try:
#             make_version(version)
#         except InvalidVersionError:
#             return False
#         return True
# 
#     def __init__(self, verstring):
#         self.__version_string = verstring
#         self.__version = make_version(verstring)
# 
#     def string(self):
#         return self.__version_string
# 
#     def compare(self, ver):
#         if isinstance(ver, basestring):
#             return cmp(self.__version, make_version(ver))
# 
#         return cmp(self.__version, ver.__version)
# 
#     def __lt__(self, rhs):
#         if isinstance(rhs, basestring):
#             return self.__version < make_version(rhs)
# 
#         return self.__version < rhs.__version
# 
#     def __le__(self, rhs):
#         if isinstance(rhs, basestring):
#             return self.__version <= make_version(rhs)
# 
#         return self.__version <= rhs.__version
# 
#     def __gt__(self, rhs):
#         if isinstance(rhs, basestring):
#             return self.__version > make_version(rhs)
# 
#         return self.__version > rhs.__version
# 
#     def __ge__(self, rhs):
#         if isinstance(rhs, basestring):
#             return self.__version >= make_version(rhs)
# 
#         return self.__version >= rhs.__version
# 
#     def __eq__(self, rhs):
#         if isinstance(rhs, basestring):
#             return self.__version_string == rhs
# 
#         return self.__version_string == rhs.__version_string
# 
#     def __str__(self):
#         return self.__version_string


# Path: tests/versiontest.py
import unittest
from pisi.version import Version

        self.assert_(v5 > v3)

    def testOpsKeywords(self):
        # with keywords
        v1 = Version("2.23_pre10")
        v2 = Version("2.23")
        v3 = Version("2.21")
        v4 = Version("2.23_p1")
        v5 = Version("2.23_beta1")
        v6 = Version("2.23_m1")
        v7 = Version("2.23_rc1")
        v8 = Version("2.23_rc2")
        self.assert_(v1 < v2)
        self.assert_(v1 > v3)
        self.assert_(v1 < v4)
        self.assert_(v1 > v5)
        self.assert_(v2 < v4)
        self.assert_(v2 > v5)
        self.assert_(v6 < v4)
        self.assert_(v6 > v5)
        self.assert_(v7 > v5)
        self.assert_(v8 > v7)

        v1 = Version("1.0_alpha1")
        v2 = Version("1.0_alpha2")
        self.assert_(v2 > v1)

    def testOpsCharacters(self):
        # with character
        v1 = Version("2.10a")

        v2 = Version("2.10")