Ejemplo n.º 1
0
 def test_too_short_spec(self):
     spec = "nothing_to_split"
     with self.assertRaisesRegexp(ValueError, "Spec is not of the form"):
         user, repo, unresolved_ref = tokenize_spec(spec)
Ejemplo n.º 2
0
def test_spec_processing(spec, raw_user, raw_repo, raw_ref):
    user, repo, unresolved_ref = tokenize_spec(spec)
    assert raw_user == user
    assert raw_repo == repo
    assert raw_ref == unresolved_ref
Ejemplo n.º 3
0
 def test_spec_with_suggestion(self):
     spec = "short/suggestion"
     error = f'Did you mean "{spec}/master"?'
     with self.assertRaisesRegex(ValueError, error):
         user, repo, unresolved_ref = tokenize_spec(spec)
Ejemplo n.º 4
0
 def test_spec_with_no_suggestion(self):
     spec = "short/master"
     error = "^((?!Did you mean).)*$"  # negative match
     with self.assertRaisesRegex(ValueError, error):
         user, repo, unresolved_ref = tokenize_spec(spec)
Ejemplo n.º 5
0
 def test_long_spec(self):
     # No specification is too long, extra slashes go to the "ref" property
     spec = "a/long/specification/with/many/slashes/to/split/on"
     spec_parts = tokenize_spec(spec)
     assert len(spec_parts) == 3
 def test_spec_with_suggestion(self):
     spec = "short/suggestion"
     error = "Did you mean \"{}/master\"?".format(spec)
     with self.assertRaisesRegex(ValueError, error):
         user, repo, unresolved_ref = tokenize_spec(spec)