[Checkins] SVN: gocept.selenium/trunk/ Fixes #7790: make patterns work with multiline strings

Wolfgang Schnerring wosc at wosc.de
Tue Aug 3 02:44:09 EDT 2010


Log message for revision 115402:
  Fixes #7790: make patterns work with multiline strings
  

Changed:
  U   gocept.selenium/trunk/CHANGES.txt
  U   gocept.selenium/trunk/src/gocept/selenium/selenese.py
  U   gocept.selenium/trunk/src/gocept/selenium/ztk/tests/test_selenese.py

-=-
Modified: gocept.selenium/trunk/CHANGES.txt
===================================================================
--- gocept.selenium/trunk/CHANGES.txt	2010-08-03 06:30:12 UTC (rev 115401)
+++ gocept.selenium/trunk/CHANGES.txt	2010-08-03 06:44:09 UTC (rev 115402)
@@ -6,6 +6,8 @@
 
 - Add a static files test layer for running selenium tests against a set
   of static (HTML) files.
+- Patterns now also work with multiline strings,
+  i. e. 'foo*' will match 'foo\nbar' (#7790).
 
 
 0.4.2 (2010-05-20)

Modified: gocept.selenium/trunk/src/gocept/selenium/selenese.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/selenese.py	2010-08-03 06:30:12 UTC (rev 115401)
+++ gocept.selenium/trunk/src/gocept/selenium/selenese.py	2010-08-03 06:44:09 UTC (rev 115402)
@@ -435,7 +435,7 @@
 
 
 def match_regex(text, pattern):
-    return re.search(pattern, text)
+    return re.search(pattern, text, re.DOTALL)
 
 
 def match_exact(text, pattern):
@@ -455,7 +455,7 @@
     * exact:string: Match a string exactly, verbatim, without any of that fancy
       wildcard stuff.
 
-      If no pattern prefix is specified, assume that it's a"glob"
+      If no pattern prefix is specified, assume that it's a "glob"
       pattern.
     """
     matcher = match_glob

Modified: gocept.selenium/trunk/src/gocept/selenium/ztk/tests/test_selenese.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/ztk/tests/test_selenese.py	2010-08-03 06:30:12 UTC (rev 115401)
+++ gocept.selenium/trunk/src/gocept/selenium/ztk/tests/test_selenese.py	2010-08-03 06:44:09 UTC (rev 115402)
@@ -47,7 +47,11 @@
         self.assert_(match('foo', 'regex:^fo+$'))
         self.assert_(not match('foo', 'regex:^f+$'))
 
+    def test_multiline_strings(self):
+        self.assert_(match('foo\nbar', 'glob:foo*'))
+        self.assert_(match('foo\nbar', 'regex:^foo.*$'))
 
+
 class UtilsTest(unittest.TestCase):
 
     def test_camelcaseconvert(self):



More information about the checkins mailing list