Commits

Brendan McCollam committed d4106f5

Fixes bug where regex dot could generate newline characters.

  • Participants
  • Parent commits 6129bac

Comments (0)

Files changed (3)

rstr/tests/test_xeger.py

         pattern = r'foo'
         assert re.match(pattern, self.rs.xeger(pattern))
 
+    def test_dot(self):
+        """
+        Verify that the dot character doesn't produce newlines.
+        See: https://bitbucket.org/leapfrogdevelopment/rstr/issue/1/
+        """
+        pattern = r'.+'
+        for i in xrange(100):
+            assert re.match(pattern, self.rs.xeger(pattern))
+
     def test_digit(self):
         pattern = r'\d'
         assert re.match(pattern, self.rs.xeger(pattern))
                                 string.printable.replace(unichr(x), '')),
              "at": lambda x: '',
              "in": lambda x: self._handle_in(x),
-             "any": lambda x: self.printable(1),
+             "any": lambda x: self.printable(1, exclude='\n'),
              "range": lambda x: [unichr(i) for i in xrange(x[0], x[1] + 1)],
              "category": lambda x: self._categories[x](),
              'branch': lambda x: ''.join(self._handle_state(i) for
 import unittest
 
 setup(name='rstr',
-      version='2.1.2',
+      version='2.1.3',
       description='Generate random strings in Python',
       author='Leapfrog Direct Response LLC',
       author_email='oss@leapfrogdevelopment.com',