Remove usage of re.compile in example code
This commit is contained in:
parent
956081cded
commit
2a1c45166e
|
@ -974,13 +974,13 @@ Using unicode in the feature files
|
|||
----------------------------------
|
||||
|
||||
As mentioned above, by default, utf-8 encoding is used for parsing feature files.
|
||||
For steps definition, you can both use unicode- and bytestrings equally.
|
||||
However, for argumented steps, if you need to use unicode symbols in it's regular expression, use `u` sign with regex:
|
||||
For steps definition, you should use unicode strings, which is the default in python 3.
|
||||
If you are on python 2, make sure you use unicode strings by prefixing them with the `u` sign.
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@given(re.compile(u"у мене є рядок який містить '{0}'".format('(?P<content>.+)')))
|
||||
@given(parsers.re(u"у мене є рядок який містить '{0}'".format(u'(?P<content>.+)')))
|
||||
def there_is_a_string_with_content(content, string):
|
||||
"""Create string with unicode content."""
|
||||
string['content'] = content
|
||||
|
|
Loading…
Reference in New Issue