From 75eedb84533d5bdc90b601beb99e3bdef8ae3690 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sat, 22 Aug 2009 14:19:23 +0200 Subject: add doctest for __sanitize_version() and build_tag() --- gbp/git.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'gbp/git.py') diff --git a/gbp/git.py b/gbp/git.py index 2fc29c9..014403e 100644 --- a/gbp/git.py +++ b/gbp/git.py @@ -206,12 +206,22 @@ def create_repo(path): def build_tag(format, version): - """Generate a tag from a given format and a version""" + """Generate a tag from a given format and a version + >>> build_tag("debian/%(version)s", "0:0~0") + 'debian/0.0' + """ return format % dict(version=__sanitize_version(version)) def __sanitize_version(version): - """sanitize a version so git accepts it as a tag""" + """sanitize a version so git accepts it as a tag + >>> __sanitize_version("0.0.0") + '0.0.0' + >>> __sanitize_version("0.0~0") + '0.0.0' + >>> __sanitize_version("0:0.0") + '0.0' + """ if ':' in version: # strip of any epochs version = version.split(':', 1)[1] return version.replace('~', '.') -- cgit v1.2.3