Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: vpython/python/version_test.go

Issue 2874683002: vpython: Version parser from PEP440. (Closed)
Patch Set: stronger test case Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vpython/python/version.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vpython/python/version_test.go
diff --git a/vpython/python/version_test.go b/vpython/python/version_test.go
index 3824a709154f08a707466131cfa3c5ab1dd343b6..048ba4dc841be0011eefc9113e7ad3f9373b5d38 100644
--- a/vpython/python/version_test.go
+++ b/vpython/python/version_test.go
@@ -28,6 +28,15 @@ func TestParseVersion(t *testing.T) {
{"2", Version{2, 0, 0}},
{"2.7", Version{2, 7, 0}},
{"2.7.12", Version{2, 7, 12}},
+ {"2.7.12+", Version{2, 7, 12}},
+ {"2.7.12+local version string", Version{2, 7, 12}},
+ {"1.4rc1", Version{1, 4, 0}},
+ {"2.7a3", Version{2, 7, 0}},
+ {"1.0b2.post345.dev456", Version{1, 0, 0}},
+ {"1.0+abc.7", Version{1, 0, 0}},
+ {"1.0.dev4", Version{1, 0, 0}},
+ {"1.0.post4", Version{1, 0, 0}},
+ {"2!1.0", Version{1, 0, 0}},
{"1000.0.1", Version{1000, 0, 1}},
}
@@ -35,13 +44,9 @@ func TestParseVersion(t *testing.T) {
input string
err string
}{
- {"a", "invalid number value"},
- {"1.2.3.4", "unsupported number of parts"},
- {"1.-2.1337", "must not be negative"},
+ {"a", "non-canonical Python version string"},
{"0.1.2", "version is incomplete"},
- {"1.1.X", "invalid patch value"},
- {"1.Y.1", "invalid minor value"},
- {"Y.1.1", "invalid major value"},
+ {"1.1.X", "non-canonical Python version string"},
}
Convey(`Testing ParseVersion`, t, func() {
« no previous file with comments | « vpython/python/version.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698