[PATCH 2 of 7 saem_ref] [ark] Add a test checking ARK_RGX pattern

Denis Laxalde denis.laxalde at logilab.fr
Wed Feb 21 12:03:27 CET 2018


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1519199999 -3600
#      Wed Feb 21 08:59:59 2018 +0100
# Node ID fe9c0e8928682ddfc5c4c862df00a7bf0bc08f40
# Parent  9f17a87a83eedfd24e852ad6b8a2110f00425bb4
# Available At http://hg.logilab.org/review/cubes/saem_ref
#              hg pull http://hg.logilab.org/review/cubes/saem_ref -r fe9c0e892868
# EXP-Topic ark/unique-overall
[ark] Add a test checking ARK_RGX pattern

Just a sanity check to make sure string interpolation in regexp pattern
build is correct.

diff --git a/test/test_ark.py b/test/test_ark.py
--- a/test/test_ark.py
+++ b/test/test_ark.py
@@ -25,6 +25,7 @@ from cubicweb.devtools import (
 )
 
 from cubicweb_saem_ref.ark import (
+    ARK_RGX,
     match as ark_match,
 )
 import testutils
@@ -36,6 +37,13 @@ def setUpModule():
 
 class ArkRgxTC(TestCase):
 
+    def test_syntax(self):
+        """Make string interpolation is correct."""
+        self.assertEqual(
+            ARK_RGX.pattern,
+            r'^(ark:/)?(?P<naan>\d+)/(?P<name>rf\w{7}g)$',
+        )
+
     def test(self):
         match = ark_match('ark:/12345/rf%sg' % ('q' * 7))
         self.assertTrue(match)



More information about the saem-devel mailing list