dch: Add doctests for snapshot_version
authorGuido Günther <agx@sigxcpu.org>
Tue, 27 Dec 2011 15:54:21 +0000 (16:54 +0100)
committerGuido Günther <agx@sigxcpu.org>
Tue, 27 Dec 2011 18:13:57 +0000 (19:13 +0100)
gbp/scripts/dch.py

index a7c3d99..8307b6c 100644 (file)
@@ -145,8 +145,16 @@ def fixup_trailer(repo, git_author, dch_options):
 
 def snapshot_version(version):
     """
-    get the current release and snapshot version
+    Get the current release and snapshot version.
+
     Format is <debian-version>~<release>.gbp<short-commit-id>
+
+    >>> snapshot_version('1.0-1')
+    ('1.0-1', 0)
+    >>> snapshot_version('1.0-1~1.test0')
+    ('1.0-1~1.test0', 0)
+    >>> snapshot_version('1.0-1~2.gbp1234')
+    ('1.0-1', 2)
     """
     try:
         (release, suffix) = version.rsplit('~', 1)