[Python-modules-commits] [python-gnupg] 02/03: Compare Keys by removing version and whitespace

Elena Grandi valhalla-guest at moszumanska.debian.org
Tue Aug 16 15:26:16 UTC 2016


This is an automated email from the git hooks/post-receive script.

valhalla-guest pushed a commit to branch master
in repository python-gnupg.

commit 81345def06fd47dbfbc8add1f460ddab5881e494
Author: Elena Grandi <valhalla-d at trueelena.org>
Date:   Tue Aug 16 17:19:12 2016 +0200

    Compare Keys by removing version and whitespace
---
 test_gnupg.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test_gnupg.py b/test_gnupg.py
index 55a3c8e..6f6b66c 100644
--- a/test_gnupg.py
+++ b/test_gnupg.py
@@ -8,6 +8,7 @@ import doctest
 import logging
 import os.path
 import os
+import re
 import shutil
 import stat
 import sys
@@ -85,10 +86,9 @@ def is_list_with_len(o, n):
 
 def compare_keys(k1, k2):
     "Compare ASCII keys"
-    k1 = k1.split('\n')
-    k2 = k2.split('\n')
-    del k1[1] # remove version lines
-    del k2[1]
+    pattern = r'-----BEGIN PGP PUBLIC KEY BLOCK-----\n.*\s+'
+    k1 = re.sub(pattern, '', k1)
+    k2 = re.sub(pattern, '', k2)
     return k1 != k2
 
 class GPGTestCase(unittest.TestCase):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-gnupg.git



More information about the Python-modules-commits mailing list