@@ -926,3 +926,45 @@ def test_to_str(self):
926926 """Test that the object serializes to str properly."""
927927 as_str = matchers .EqualToSemverMatcher (self .raw )
928928 assert str (as_str ) == "equal semver 2.1.8"
929+
930+ class GreaterThanOrEqualToSemverMatcherTests (MatcherTestsBase ):
931+ """Semver greater or equalto matcher test cases."""
932+
933+ raw = {
934+ 'negate' : False ,
935+ 'matcherType' : 'GREATER_THAN_OR_EQUAL_TO_SEMVER' ,
936+ 'stringMatcherData' : "2.1.8"
937+ }
938+
939+ def test_from_raw (self , mocker ):
940+ """Test parsing from raw json/dict."""
941+ parsed = matchers .from_raw (self .raw )
942+ assert isinstance (parsed , matchers .GreaterThanOrEqualToSemverMatcher )
943+ assert parsed ._data == "2.1.8"
944+ assert isinstance (parsed ._semver , Semver )
945+ assert parsed ._semver ._major == 2
946+ assert parsed ._semver ._minor == 1
947+ assert parsed ._semver ._patch == 8
948+ assert parsed ._semver ._pre_release == []
949+
950+ def test_matcher_behaviour (self , mocker ):
951+ """Test if the matcher works properly."""
952+ parsed = matchers .from_raw (self .raw )
953+ assert parsed ._match ("2.1.8+rc" )
954+ assert parsed ._match ("2.1.8" )
955+ assert parsed ._match ("2.1.11" )
956+ assert not parsed ._match ("2.1.5" )
957+ assert not parsed ._match ("2.1.5-rc1" )
958+ assert not parsed ._match (None )
959+ assert not parsed ._match ("semver" )
960+
961+ def test_to_json (self ):
962+ """Test that the object serializes to JSON properly."""
963+ as_json = matchers .GreaterThanOrEqualToSemverMatcher (self .raw ).to_json ()
964+ assert as_json ['matcherType' ] == 'GREATER_THAN_OR_EQUAL_TO_SEMVER'
965+ assert as_json ['stringMatcherData' ] == "2.1.8"
966+
967+ def test_to_str (self ):
968+ """Test that the object serializes to str properly."""
969+ as_str = matchers .GreaterThanOrEqualToSemverMatcher (self .raw )
970+ assert str (as_str ) == "greater than or equal to semver 2.1.8"
0 commit comments