commit c7805243469e1b6e71d963eae6e58b032998ceca Author: Isis Lovecruft isis@torproject.org Date: Tue Apr 22 21:05:25 2014 +0000
Add a doctest and fix outdated parameter refs in b.p.v.Version docstring. --- lib/bridgedb/parse/versions.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/lib/bridgedb/parse/versions.py b/lib/bridgedb/parse/versions.py index e5e4ab5..b327cb8 100644 --- a/lib/bridgedb/parse/versions.py +++ b/lib/bridgedb/parse/versions.py @@ -45,10 +45,25 @@ class Version(txutil.Version):
Comparisons may be computed between instances of :class:`Version`s.
- :param string version: One of ``SERVER_VERSIONS``. - :param string package: The package or program which we are creating a - version number for, i.e. for "tor-0.2.5.1-alpha" the ``package`` - would be "tor". + >>> from bridgedb.parse.versions import Version + >>> v1 = Version("0.2.3.25", package="tor") + >>> v1.base() + '0.2.3.25' + >>> v1.package + 'tor' + >>> v2 = Version("0.2.5.1-alpha", package="tor") + >>> v2 + Version(package=tor, major=0, minor=2, micro=5, prerelease=1-alpha) + >>> v1 == v2 + False + >>> v2 > v1 + True + + :param str version: A Tor version string specifier, i.e. one taken + from either the ``client-versions`` or ``server-versions`` lines + within a Tor ``cached-consensus`` file. + :param str package: The package or program which we are creating a + version number for. """ if version.find('.') == -1: print("Version.__init__(): %r doesn't look like a version string!"
tor-commits@lists.torproject.org