MCPcopy Index your code
hub / github.com/google/osv.dev / test_empty_identifier

Method test_empty_identifier

osv/ecosystems/pub_test.py:81–108  ·  view source on GitHub ↗

Test parsing versions with empty identifiers. Although it's unlikely that it was intentional, SemVer 2.0.0-rc.1 does not explicitly disallow this case. Not sure if Pub even allows it. This test is probably unnecessary.

(self)

Source from the content-addressed store, hash-verified

79 pub.Version.from_string('3.4.0rc3-invalid')
80
81 def test_empty_identifier(self):
82 """Test parsing versions with empty identifiers.
83
84 Although it's unlikely that it was intentional, SemVer 2.0.0-rc.1 does not
85 explicitly disallow this case. Not sure if Pub even allows it.
86
87 This test is probably unnecessary."""
88
89 pub.Version.from_string('1.0.0-a..b')
90 pub.Version.from_string('1.0.0-.a.b')
91 pub.Version.from_string('1.0.0-a.b.')
92 pub.Version.from_string('1.0.0+a..b')
93 pub.Version.from_string('1.0.0+.a.b')
94 pub.Version.from_string('1.0.0+a.b.')
95 pub.Version.from_string('1.0.0-+')
96 pub.Version.from_string('1.0.0-.+.')
97 pub.Version.from_string('1.0.0-....+....')
98
99 # Basic test for ordering.
100 v_empty = pub.Version.from_string('1.0.0-a..b')
101 v_number = pub.Version.from_string('1.0.0-a.0.b')
102 v_str = pub.Version.from_string('1.0.0-a.a.b')
103 self.assertLess(v_number, v_empty)
104 self.assertLess(v_empty, v_str)
105
106 # note(michaelkedar):
107 # The implementation incorrectly assumes "1.0.0-a..b" == "1.0.0-a.-.b"
108 # I have decided that this extreme edge case is not worth fixing.
109
110
111class PubEcosystemTest(vcr.unittest.VCRTestCase):

Callers

nothing calls this directly

Calls 1

from_stringMethod · 0.45

Tested by

no test coverage detected