Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
django-taggit
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f56fde4e
authored
Dec 31, 2009
by
Alex Gaynor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure we catch ordering errors where ordering is relevant.
parent
09649b88
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
taggit/tests/tests.py
+7
-3
No files found.
taggit/tests/tests.py
View file @
f56fde4e
...
...
@@ -6,8 +6,12 @@ from taggit.tests.models import Food, Pet
class
BaseTaggingTest
(
TestCase
):
def
assert_tags_equal
(
self
,
qs
,
tags
):
self
.
assertEqual
(
sorted
(
map
(
lambda
tag
:
tag
.
name
,
qs
)),
sorted
(
list
(
tags
)))
def
assert_tags_equal
(
self
,
qs
,
tags
,
sort
=
True
):
got
=
map
(
lambda
tag
:
tag
.
name
,
qs
)
if
sort
:
got
.
sort
()
tags
.
sort
()
self
.
assertEqual
(
got
,
tags
)
class
AddTagTestCase
(
BaseTaggingTest
):
...
...
@@ -29,7 +33,7 @@ class AddTagTestCase(BaseTaggingTest):
self
.
assert_tags_equal
(
apple
.
tags
.
all
(),
[
'green'
,
'red'
])
self
.
assert_tags_equal
(
Food
.
tags
.
all
(),
[
'green'
,
'red'
])
self
.
assert_tags_equal
(
Food
.
tags
.
most_common
(),
[
'green'
,
'red'
])
self
.
assert_tags_equal
(
Food
.
tags
.
most_common
(),
[
'green'
,
'red'
]
,
sort
=
False
)
apple
.
tags
.
remove
(
'green'
)
self
.
assert_tags_equal
(
apple
.
tags
.
all
(),
[
'red'
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment