Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4dcef63

Browse files
committed
v0.2.1
------ Added `django.setup()` for tests, because looks like now it is required. README.markdown fixes.
1 parent f7275ef commit 4dcef63

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

‎CHANGELOG.markdown‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
v0.2.1
2+
------
3+
4+
Added `django.setup()` for tests, because looks like now it is required. README.markdown fixes.
5+
16
v0.2.0
27
------
38

‎README.markdown‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [Django Macros URL](https://github.com/phpdude/django-macros-url/) v0.2.0 - Routing must be simple as possible
1+
# [Django Macros URL](https://github.com/phpdude/django-macros-url/) v0.2.1 - Routing must be simple as possible
22

33
Django Macros URL makes it easy to write (and read) URL patterns in your Django applications by using macros.
44

‎macrosurl/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import re
22

3-
VERSION = (0, 2, 0)
3+
VERSION = (0, 2, 1)
44

55
_macros_library = {
66
'id': r'\d+',

‎tests/urls.py‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1+
import os
12
import sys
23
import uuid
34

5+
import django
46
from django.conf.urls import include
57

8+
from macrosurl import MacroUrlPattern, url
9+
610
if sys.version_info >= (2, 7):
711
import unittest
812
else:
913
from django.utils import unittest
1014

11-
from macrosurl import MacroUrlPattern, url
15+
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
16+
django.setup()
1217

1318

1419
class TestRegexCompilation(unittest.TestCase):
@@ -47,7 +52,7 @@ def test_pk(self):
4752
'^product/(?P<pk>\d+)/(?P<product_pk>\d+)$')
4853
self.assertEqual(MacroUrlPattern('product/:pk/:product_pk/:news_pk').compiled,
4954
'^product/(?P<pk>\d+)/(?P<product_pk>\d+)/(?P<news_pk>\d+)$')
50-
55+
5156
def test_page(self):
5257
self.assertEqual(MacroUrlPattern('page/:page').compiled, '^page/(?P<page>\d+)$')
5358
self.assertEqual(MacroUrlPattern('product/:product_page').compiled, '^product/(?P<product_page>\d+)$')
@@ -78,11 +83,14 @@ def test_date(self):
7883

7984
def test_uid(self):
8085
self.assertEqual(MacroUrlPattern('invoice/:uuid').compiled,
81-
'^invoice/(?P<uuid>[a-fA-F0-9]{8}-?[a-fA-F0-9]{4}-?[1345][a-fA-F0-9]{3}-?[a-fA-F0-9]{4}-?[a-fA-F0-9]{12})$')
86+
'^invoice/(?P<uuid>[a-fA-F0-9]{8}-?[a-fA-F0-9]{4}-?[1345][a-fA-F0-9]{3}-?[a-fA-F0-9]{4}-?['
87+
'a-fA-F0-9]{12})$')
8288

8389
def test_strongurl(self):
8490
self.assertEqual(MacroUrlPattern('orders/:date/:uuid/products/:slug/:variant_id').compiled,
85-
'^orders/(?P<date>\\d{4}-(0?([1-9])|10|11|12)-((0|1|2)?([1-9])|[1-3]0|31))/(?P<uuid>[a-fA-F0-9]{8}-?[a-fA-F0-9]{4}-?[1345][a-fA-F0-9]{3}-?[a-fA-F0-9]{4}-?[a-fA-F0-9]{12})/products/(?P<slug>[\\w-]+)/(?P<variant_id>\\d+)$')
91+
'^orders/(?P<date>\\d{4}-(0?([1-9])|10|11|12)-((0|1|2)?([1-9])|[1-3]0|31))/(?P<uuid>['
92+
'a-fA-F0-9]{8}-?[a-fA-F0-9]{4}-?[1345][a-fA-F0-9]{3}-?[a-fA-F0-9]{4}-?[a-fA-F0-9]{'
93+
'12})/products/(?P<slug>[\\w-]+)/(?P<variant_id>\\d+)$')
8694

8795
# noinspection PyProtectedMember
8896
def test_includes_end(self):

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /