Exemple #1
0
 def test_bad_types(self):
     a = '1:6.0.0-2.el7ost'
     b = 1
     with pytest.raises(ValueError):
         labelCompare(a, b)
     with pytest.raises(ValueError):
         labelCompare(b, a)
Exemple #2
0
 def test_bad_length(self):
     a = ('1', '6.0.0', '2.el7ost', 1)
     b = ('0', '6.0.1', '2.el7ost')
     with pytest.raises(ValueError):
         labelCompare(a, b)
     with pytest.raises(ValueError):
         labelCompare(b, a)
Exemple #3
0
 def test_eq_epoch(self):
     a = ('1', '6.0.0', '2.el7ost')
     b = ('1', '6.0.1', '2.el7ost')
     assert labelCompare(a, b) == -1
     assert labelCompare(a, a) == 0
     assert labelCompare(b, a) == 1
     assert labelCompare(b, b) == 0
Exemple #4
0
 def test_basic(self):
     a = ('0', '6.0.0', '2.el7ost')
     b = ('0', '6.0.1', '2.el7ost')
     assert labelCompare(a, b) == -1
     assert labelCompare(a, a) == 0
     assert labelCompare(b, a) == 1
     assert labelCompare(b, b) == 0
Exemple #5
0
 def test_neq_epoch(self):
     # a always wins.
     a = ('1', '6.0.0', '2.el7ost')
     b = ('0', '6.0.1', '2.el7ost')
     assert labelCompare(a, b) == 1
     assert labelCompare(a, a) == 0
     assert labelCompare(b, a) == -1
     assert labelCompare(b, b) == 0
Exemple #6
0
 def test_zero_epoch(self):
     # 0 and no epoch are the same
     a = ('0', '6.0.0', '2.el7ost')
     b = ('6.0.1', '2.el7ost')
     assert labelCompare(a, b) == -1
     assert labelCompare(a, a) == 0
     assert labelCompare(b, a) == 1
     assert labelCompare(b, b) == 0
Exemple #7
0
 def test_vr_only(self):
     # no epoch => epoch = 0
     a = ('6.0.0', '2.el7ost')
     b = ('6.0.1', '2.el7ost')
     assert labelCompare(a, b) == -1
     assert labelCompare(a, a) == 0
     assert labelCompare(b, a) == 1
     assert labelCompare(b, b) == 0
Exemple #8
0
    def test_weird_versions(self):
        a = ('0', 'a', '1')
        b = ('0', '1', '1')
        assert labelCompare(a, b) == -1
        assert labelCompare(b, a) == 1

        a = ('0', '1.01.001', '1')
        b = ('0', '1.1.1', '1')
        assert labelCompare(a, b) == 0

        a = ('0', '~1', '1')
        b = ('0', '1', '1')
        assert labelCompare(a, b) == -1
        assert labelCompare(b, a) == 1

        a = ('0', '1~1', '1')
        b = ('0', '1', '1')
        assert labelCompare(a, b) == -1
        assert labelCompare(b, a) == 1
Exemple #9
0
 def test_bad_epoch(self):
     a = ('abcde', '1.0', '1')
     b = ('1.0', '1')
     with pytest.raises(ValueError):
         labelCompare(a, b)