Skip to content

Commit

Permalink
Fix "invalid escape sequence" warnings in Python 3.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Dec 30, 2017
1 parent 9ab0405 commit 4abdcfd
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tcms/core/views/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def search(request):
if search_type not in models:
raise Http404

try_to_get_object = re.match('^\d+$', search_content) is not None
try_to_get_object = re.match(r'^\d+$', search_content) is not None
model = models[search_type]

if try_to_get_object:
Expand Down
2 changes: 1 addition & 1 deletion tcms/testcases/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ class TestCaseBugSystem(TCMSActionModel):
validate_reg_exp = models.CharField(
max_length=128,
verbose_name='RegExp for ID validation',
help_text='A valid JavaScript regular expression such as ^\d$',
help_text=r'A valid JavaScript regular expression such as ^\d$',
)

tracker_type = models.CharField(
Expand Down
2 changes: 1 addition & 1 deletion tcms/testcases/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ def setUpTestData(cls):
# test data for Issue #78
# https://github.com/kiwitcms/Kiwi/issues/78
cls.case_bogus_summary = TestCaseFactory(
summary="""A Test Case with backslash(\), single quotes(') and double quotes(")""",
summary=r"""A Test Case with backslash(\), single quotes(') and double quotes(")""",
plan=[cls.plan])

cls.search_data = {
Expand Down
2 changes: 1 addition & 1 deletion tcms/testplans/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ def setUpTestData(cls):
# test data for Issue #78
# https://github.com/kiwitcms/Kiwi/issues/78
cls.plan_bogus_name = TestPlanFactory(
name="""A name with backslash(\), single quotes(') and double quotes(")""",
name=r"""A name with backslash(\), single quotes(') and double quotes(")""",
author=cls.tester,
owner=cls.tester,
product=cls.product,
Expand Down
10 changes: 5 additions & 5 deletions tcms/testruns/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ def setUpTestData(cls):
# test data for Issue #78
# https://github.com/kiwitcms/Kiwi/issues/78
cls.run_bogus_summary = TestRunFactory(
summary="""A summary with backslash(\), single quotes(') and double quotes(")""",
summary=r"""A summary with backslash(\), single quotes(') and double quotes(")""",
manager=cls.tester,
default_tester=UserFactory(username='bogus_tester', email='[email protected]'))

Expand Down Expand Up @@ -864,7 +864,7 @@ def setUpTestData(cls):
# test data for Issue #78
# https://github.com/kiwitcms/Kiwi/issues/78
cls.run_bogus_summary = TestRunFactory(
summary="""A summary with backslash(\), single quotes(') and double quotes(")""",
summary=r"""A summary with backslash(\), single quotes(') and double quotes(")""",
plan=cls.plan)

def test_load_runs(self):
Expand Down Expand Up @@ -1373,7 +1373,7 @@ def setUpTestData(cls):
cls.it = TestCaseBugSystem.objects.create(
name='Partially configured JIRA',
url_reg_exp='https://jira.example.com/browse/%s',
validate_reg_exp='^[A-Z0-9]+-\d+$',
validate_reg_exp=r'^[A-Z0-9]+-\d+$',
tracker_type='JIRA'
)

Expand Down Expand Up @@ -1401,7 +1401,7 @@ def setUpTestData(cls):
cls.it = TestCaseBugSystem.objects.create(
name='Partially configured Bugzilla',
url_reg_exp='https://bugzilla.example.com/show_bug.cgi?id=%s',
validate_reg_exp='^\d{1,7}$',
validate_reg_exp=r'^\d{1,7}$',
tracker_type='Bugzilla'
)

Expand Down Expand Up @@ -1429,7 +1429,7 @@ def setUpTestData(cls):
cls.it = TestCaseBugSystem.objects.create(
name='Partially configured GitHub',
url_reg_exp='https://github.com/kiwitcms/Kiwi/issues/%s',
validate_reg_exp='^\d+$',
validate_reg_exp=r'^\d+$',
tracker_type='GitHub'
)

Expand Down
4 changes: 2 additions & 2 deletions tcms/xmlrpc/tests/test_testrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _fixture_setup(self):
def test_single_id(self):
'''Test with singal plan id and tag id'''
with self.assertRaisesRegex(XmlRPCFault,
".*Parameter tags must be a string or list\(string\).*"):
r".*Parameter tags must be a string or list\(string\).*"):
self.rpc_client.TestRun.add_tag(self.test_runs[0].pk, self.tag0.pk)

self.rpc_client.TestRun.add_tag(self.test_runs[0].pk, self.tag0.name)
Expand Down Expand Up @@ -89,7 +89,7 @@ def test_single_id(self):
'''Test with single plan id and tag id'''
# removing by ID raises an error
with self.assertRaisesRegex(XmlRPCFault,
".*Parameter tags must be a string or list\(string\).*"):
r".*Parameter tags must be a string or list\(string\).*"):
self.rpc_client.TestRun.remove_tag(self.test_runs[0].pk, self.tag0.pk)

# removing by name works fine
Expand Down

0 comments on commit 4abdcfd

Please sign in to comment.