Make discover.version_between private
There's some ongoing concern about exactly how discover.version_between should work. Since it's new, make it private initially in the release to give us time to work it out. Change-Id: I349423f1b3da74b139f5fec838597c9a824ba571
This commit is contained in:
parent
029b2a37e9
commit
e2d4c30dcb
|
@ -275,7 +275,7 @@ def version_to_string(version):
|
|||
return ".".join(map(_str_or_latest, version))
|
||||
|
||||
|
||||
def version_between(min_version, max_version, candidate):
|
||||
def _version_between(min_version, max_version, candidate):
|
||||
"""Determine whether a candidate version is within a specified range.
|
||||
|
||||
:param min_version: Normalized lower bound. May be None. May be
|
||||
|
@ -614,7 +614,7 @@ class Discover(object):
|
|||
return data
|
||||
if _latest_soft_match(min_version, data['version']):
|
||||
return data
|
||||
if version_between(min_version, max_version, data['version']):
|
||||
if _version_between(min_version, max_version, data['version']):
|
||||
return data
|
||||
|
||||
# If there is no version requested and we could not find a matching
|
||||
|
@ -967,7 +967,8 @@ class EndpointData(object):
|
|||
except TypeError:
|
||||
pass
|
||||
else:
|
||||
is_between = version_between(min_version, max_version, url_version)
|
||||
is_between = _version_between(min_version, max_version,
|
||||
url_version)
|
||||
exact_match = (is_between and max_version and
|
||||
max_version[0] == url_version[0])
|
||||
high_match = (is_between and max_version and
|
||||
|
|
|
@ -381,14 +381,14 @@ class DiscoverUtils(utils.TestCase):
|
|||
|
||||
def test_version_between(self):
|
||||
def good(minver, maxver, cand):
|
||||
self.assertTrue(discover.version_between(minver, maxver, cand))
|
||||
self.assertTrue(discover._version_between(minver, maxver, cand))
|
||||
|
||||
def bad(minver, maxver, cand):
|
||||
self.assertFalse(discover.version_between(minver, maxver, cand))
|
||||
self.assertFalse(discover._version_between(minver, maxver, cand))
|
||||
|
||||
def exc(minver, maxver, cand):
|
||||
self.assertRaises(ValueError,
|
||||
discover.version_between, minver, maxver, cand)
|
||||
discover._version_between, minver, maxver, cand)
|
||||
|
||||
good((1, 0), (1, 0), (1, 0))
|
||||
good((1, 0), (1, 10), (1, 2))
|
||||
|
|
Loading…
Reference in New Issue