예제 #1
0
    def test_version_comparison(self):
        alllangs = ['java', 'js', 'ruby', 'python']

        for lval, rval, lang, result in self.versions:
            if lang == 'all':
                testlangs = alllangs
            else:
                testlangs = [lang]
            for language in testlangs:
                print(('{} {} {}, Expected: {}'.format(lval, rval, language,
                                                       result)))
                if type(result) == bool:
                    self.assertEqual(
                        result, compare_versions(lval, rval,
                                                 language=language))
                else:
                    did_exception = False
                    try:
                        compare_versions(lval, rval, language=language)
                        did_exception = False
                    except:
                        did_exception = True
                    self.assertEqual(True, did_exception)
예제 #2
0
def test_not_greater_than(greater_than_versions_high, right, lang):
    assert compare_versions(greater_than_versions_high, right, lang) is False
예제 #3
0
def test_not_lesser_than(lesser_than_versions_low, right, lang):
    assert compare_versions(lesser_than_versions_low, right, lang) is False
예제 #4
0
def test_greater_than_rc(greater_than_rc_versions, right, lang):
    assert compare_versions(greater_than_rc_versions, right, lang) is True
예제 #5
0
def test_lesser_than_rc(lesser_than_rc_versions, right, lang):
    assert compare_versions(lesser_than_rc_versions, right, lang) is True
예제 #6
0
 def test_doesnt_match_generic_languages(self, left, right, lang):
     assert compare_versions(left, right, lang) is False
예제 #7
0
 def test_matches_generic_languages(self, left, right, lang):
     assert compare_versions(left, right, lang) is True
예제 #8
0
 def test_error_matches(self, left, right, lang):
     with pytest.raises(Exception):
         compare_versions(left, right, lang)
예제 #9
0
 def test_unsupported(self):
     with pytest.raises(Exception):
         compare_versions("> 1.0", "1.0", "VimScript")
예제 #10
0
 def test_doesnt_match(self, left, right, lang):
     assert compare_versions(left, right, lang) is False