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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
2219a6e1
authored
Mar 25, 2013
by
Florian Apolloner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced custom assert_num_queries with the builtin assertNumQueries.
parent
93493064
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
16 deletions
+3
-16
tests/tests.py
+3
-16
No files found.
tests/tests.py
View file @
2219a6e1
...
...
@@ -29,19 +29,6 @@ class BaseTaggingTest(object):
tags
.
sort
()
self
.
assertEqual
(
got
,
tags
)
def
assert_num_queries
(
self
,
n
,
f
,
*
args
,
**
kwargs
):
original_DEBUG
=
settings
.
DEBUG
settings
.
DEBUG
=
True
current
=
len
(
connection
.
queries
)
try
:
f
(
*
args
,
**
kwargs
)
self
.
assertEqual
(
len
(
connection
.
queries
)
-
current
,
n
,
)
finally
:
settings
.
DEBUG
=
original_DEBUG
def
_get_form_str
(
self
,
form_str
):
if
django
.
VERSION
>=
(
1
,
3
):
form_str
%=
{
...
...
@@ -152,15 +139,15 @@ class TaggableManagerTestCase(BaseTaggingTestCase):
# + 3 queries to create the tags.
# + 6 queries to create the intermediary things (including SELECTs, to
# make sure we don't double create.
self
.
assert
_num_q
ueries
(
10
,
apple
.
tags
.
add
,
"red"
,
"delicious"
,
"green"
)
self
.
assert
NumQ
ueries
(
10
,
apple
.
tags
.
add
,
"red"
,
"delicious"
,
"green"
)
pear
=
self
.
food_model
.
objects
.
create
(
name
=
"pear"
)
# 1 query to see which tags exist
# + 4 queries to create the intermeidary things (including SELECTs, to
# make sure we dont't double create.
self
.
assert
_num_q
ueries
(
5
,
pear
.
tags
.
add
,
"green"
,
"delicious"
)
self
.
assert
NumQ
ueries
(
5
,
pear
.
tags
.
add
,
"green"
,
"delicious"
)
self
.
assert
_num_q
ueries
(
0
,
pear
.
tags
.
add
)
self
.
assert
NumQ
ueries
(
0
,
pear
.
tags
.
add
)
def
test_require_pk
(
self
):
food_instance
=
self
.
food_model
()
...
...
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