# -*- coding: utf-8 -*-

from unittest import TestCase

from semver import compare
from semver import match
from semver import parse


class TestSemver(TestCase):
    def test_should_parse_version(self):
        self.assertEquals(
            parse("1.2.3-alpha.1.2+build.11.e0f985a"),
            {'major': 1,
             'minor': 2,
             'patch': 3,
             'prerelease': 'alpha.1.2',
             'build': 'build.11.e0f985a'})

    def test_should_get_less(self):
        self.assertEquals(
            compare("1.0.0", "2.0.0"),
            -1)

    def test_should_get_greater(self):
        self.assertEquals(
            compare("2.0.0", "1.0.0"),
            1)

    def test_should_match_simple(self):
        self.assertEquals(
            match("2.3.7", ">=2.3.6"),
            True)

    def test_should_no_match_simple(self):
        self.assertEquals(
            match("2.3.7", ">=2.3.8"),
            False)

@@ -48,17 +48,16 @@
 estCase%0A
-%0A
 from sem
@@ -930,8 +930,514 @@
  False)%0A
+%0A    def test_should_raise_value_error_for_invalid_value(self):%0A        self.assertRaises(ValueError, compare, 'foo', 'bar')%0A        self.assertRaises(ValueError, compare, '1.0', '1.0.0')%0A        self.assertRaises(ValueError, compare, '1.x', '1.0.0')%0A%0A    def test_should_raise_value_error_for_invalid_match_expression(self):%0A        self.assertRaises(ValueError, match, '1.0.0', '')%0A        self.assertRaises(ValueError, match, '1.0.0', '!')%0A        self.assertRaises(ValueError, match, '1.0.0', '1.0.0')%0A

Add tests for error cases that proves incompatibility with Python 2.5 and early versions.