Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
2791fbf5
Kaydet (Commit)
2791fbf5
authored
Nis 09, 2014
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Used more specific test assertions.
üst
11e7254c
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
19 additions
and
20 deletions
+19
-20
test_views.py
django/contrib/auth/tests/test_views.py
+1
-2
test_forms.py
django/contrib/formtools/tests/wizard/test_forms.py
+2
-2
tests.py
django/contrib/gis/geoip/tests.py
+1
-1
tests.py
django/contrib/gis/tests/geoapp/tests.py
+1
-1
tests.py
django/contrib/gis/tests/relatedapp/tests.py
+3
-3
test_measure.py
django/contrib/gis/tests/test_measure.py
+1
-1
tests.py
django/contrib/sites/tests.py
+3
-3
testcases.py
django/test/testcases.py
+2
-2
tests.py
tests/backends/tests.py
+2
-2
test_forms.py
tests/forms_tests/tests/test_forms.py
+2
-2
tests.py
tests/model_fields/tests.py
+1
-1
No files found.
django/contrib/auth/tests/test_views.py
Dosyayı görüntüle @
2791fbf5
...
@@ -475,8 +475,7 @@ class LoginTest(AuthViewsTestCase):
...
@@ -475,8 +475,7 @@ class LoginTest(AuthViewsTestCase):
self
.
assertEqual
(
response
.
context
[
'site_name'
],
site
.
name
)
self
.
assertEqual
(
response
.
context
[
'site_name'
],
site
.
name
)
else
:
else
:
self
.
assertIsInstance
(
response
.
context
[
'site'
],
RequestSite
)
self
.
assertIsInstance
(
response
.
context
[
'site'
],
RequestSite
)
self
.
assertTrue
(
isinstance
(
response
.
context
[
'form'
],
AuthenticationForm
),
self
.
assertIsInstance
(
response
.
context
[
'form'
],
AuthenticationForm
)
'Login form is not an AuthenticationForm'
)
def
test_security_check
(
self
,
password
=
'password'
):
def
test_security_check
(
self
,
password
=
'password'
):
login_url
=
reverse
(
'login'
)
login_url
=
reverse
(
'login'
)
...
...
django/contrib/formtools/tests/wizard/test_forms.py
Dosyayı görüntüle @
2791fbf5
...
@@ -246,11 +246,11 @@ class SessionFormTests(TestCase):
...
@@ -246,11 +246,11 @@ class SessionFormTests(TestCase):
def
test_init
(
self
):
def
test_init
(
self
):
request
=
get_request
()
request
=
get_request
()
testform
=
SessionWizardView
.
as_view
([(
'start'
,
Step1
)])
testform
=
SessionWizardView
.
as_view
([(
'start'
,
Step1
)])
self
.
assert
True
(
isinstance
(
testform
(
request
),
TemplateResponse
)
)
self
.
assert
IsInstance
(
testform
(
request
),
TemplateResponse
)
class
CookieFormTests
(
TestCase
):
class
CookieFormTests
(
TestCase
):
def
test_init
(
self
):
def
test_init
(
self
):
request
=
get_request
()
request
=
get_request
()
testform
=
CookieWizardView
.
as_view
([(
'start'
,
Step1
)])
testform
=
CookieWizardView
.
as_view
([(
'start'
,
Step1
)])
self
.
assert
True
(
isinstance
(
testform
(
request
),
TemplateResponse
)
)
self
.
assert
IsInstance
(
testform
(
request
),
TemplateResponse
)
django/contrib/gis/geoip/tests.py
Dosyayı görüntüle @
2791fbf5
...
@@ -106,7 +106,7 @@ class GeoIPTest(unittest.TestCase):
...
@@ -106,7 +106,7 @@ class GeoIPTest(unittest.TestCase):
self
.
assertEqual
(
'TX'
,
d
[
'region'
])
self
.
assertEqual
(
'TX'
,
d
[
'region'
])
self
.
assertEqual
(
713
,
d
[
'area_code'
])
self
.
assertEqual
(
713
,
d
[
'area_code'
])
geom
=
g
.
geos
(
query
)
geom
=
g
.
geos
(
query
)
self
.
assert
True
(
isinstance
(
geom
,
GEOSGeometry
)
)
self
.
assert
IsInstance
(
geom
,
GEOSGeometry
)
lon
,
lat
=
(
-
95.4010
,
29.7079
)
lon
,
lat
=
(
-
95.4010
,
29.7079
)
lat_lon
=
g
.
lat_lon
(
query
)
lat_lon
=
g
.
lat_lon
(
query
)
lat_lon
=
(
lat_lon
[
1
],
lat_lon
[
0
])
lat_lon
=
(
lat_lon
[
1
],
lat_lon
[
0
])
...
...
django/contrib/gis/tests/geoapp/tests.py
Dosyayı görüntüle @
2791fbf5
...
@@ -201,7 +201,7 @@ class GeoModelTest(TestCase):
...
@@ -201,7 +201,7 @@ class GeoModelTest(TestCase):
as_text
=
'ST_AsText'
if
postgis
else
'asText'
as_text
=
'ST_AsText'
if
postgis
else
'asText'
cities2
=
City
.
objects
.
raw
(
'select id, name,
%
s(point) from geoapp_city'
%
as_text
)
cities2
=
City
.
objects
.
raw
(
'select id, name,
%
s(point) from geoapp_city'
%
as_text
)
self
.
assertEqual
(
len
(
cities1
),
len
(
list
(
cities2
)))
self
.
assertEqual
(
len
(
cities1
),
len
(
list
(
cities2
)))
self
.
assert
True
(
isinstance
(
cities2
[
0
]
.
point
,
Point
)
)
self
.
assert
IsInstance
(
cities2
[
0
]
.
point
,
Point
)
@skipUnless
(
HAS_GEOS
and
HAS_SPATIAL_DB
,
"Geos and spatial db are required."
)
@skipUnless
(
HAS_GEOS
and
HAS_SPATIAL_DB
,
"Geos and spatial db are required."
)
...
...
django/contrib/gis/tests/relatedapp/tests.py
Dosyayı görüntüle @
2791fbf5
...
@@ -179,8 +179,8 @@ class RelatedGeoModelTest(TestCase):
...
@@ -179,8 +179,8 @@ class RelatedGeoModelTest(TestCase):
for
m
,
d
,
t
in
zip
(
gqs
,
gvqs
,
gvlqs
):
for
m
,
d
,
t
in
zip
(
gqs
,
gvqs
,
gvlqs
):
# The values should be Geometry objects and not raw strings returned
# The values should be Geometry objects and not raw strings returned
# by the spatial database.
# by the spatial database.
self
.
assert
True
(
isinstance
(
d
[
'point'
],
Geometry
)
)
self
.
assert
IsInstance
(
d
[
'point'
],
Geometry
)
self
.
assert
True
(
isinstance
(
t
[
1
],
Geometry
)
)
self
.
assert
IsInstance
(
t
[
1
],
Geometry
)
self
.
assertEqual
(
m
.
point
,
d
[
'point'
])
self
.
assertEqual
(
m
.
point
,
d
[
'point'
])
self
.
assertEqual
(
m
.
point
,
t
[
1
])
self
.
assertEqual
(
m
.
point
,
t
[
1
])
...
@@ -255,7 +255,7 @@ class RelatedGeoModelTest(TestCase):
...
@@ -255,7 +255,7 @@ class RelatedGeoModelTest(TestCase):
qs
=
Location
.
objects
.
filter
(
id
=
5
)
.
annotate
(
num_cities
=
Count
(
'city'
))
.
values
(
'id'
,
'point'
,
'num_cities'
)
qs
=
Location
.
objects
.
filter
(
id
=
5
)
.
annotate
(
num_cities
=
Count
(
'city'
))
.
values
(
'id'
,
'point'
,
'num_cities'
)
self
.
assertEqual
(
1
,
len
(
qs
))
self
.
assertEqual
(
1
,
len
(
qs
))
self
.
assertEqual
(
2
,
qs
[
0
][
'num_cities'
])
self
.
assertEqual
(
2
,
qs
[
0
][
'num_cities'
])
self
.
assert
True
(
isinstance
(
qs
[
0
][
'point'
],
GEOSGeometry
)
)
self
.
assert
IsInstance
(
qs
[
0
][
'point'
],
GEOSGeometry
)
# TODO: The phantom model does appear on Oracle.
# TODO: The phantom model does appear on Oracle.
@no_oracle
@no_oracle
...
...
django/contrib/gis/tests/test_measure.py
Dosyayı görüntüle @
2791fbf5
...
@@ -93,7 +93,7 @@ class DistanceTest(unittest.TestCase):
...
@@ -93,7 +93,7 @@ class DistanceTest(unittest.TestCase):
self
.
assertEqual
(
d5
,
50
)
self
.
assertEqual
(
d5
,
50
)
a5
=
d1
*
D
(
m
=
10
)
a5
=
d1
*
D
(
m
=
10
)
self
.
assert
True
(
isinstance
(
a5
,
Area
)
)
self
.
assert
IsInstance
(
a5
,
Area
)
self
.
assertEqual
(
a5
.
sq_m
,
100
*
10
)
self
.
assertEqual
(
a5
.
sq_m
,
100
*
10
)
with
self
.
assertRaises
(
TypeError
):
with
self
.
assertRaises
(
TypeError
):
...
...
django/contrib/sites/tests.py
Dosyayı görüntüle @
2791fbf5
...
@@ -26,7 +26,7 @@ class SitesFrameworkTests(TestCase):
...
@@ -26,7 +26,7 @@ class SitesFrameworkTests(TestCase):
def
test_site_manager
(
self
):
def
test_site_manager
(
self
):
# Make sure that get_current() does not return a deleted Site object.
# Make sure that get_current() does not return a deleted Site object.
s
=
Site
.
objects
.
get_current
()
s
=
Site
.
objects
.
get_current
()
self
.
assert
True
(
isinstance
(
s
,
Site
)
)
self
.
assert
IsInstance
(
s
,
Site
)
s
.
delete
()
s
.
delete
()
self
.
assertRaises
(
ObjectDoesNotExist
,
Site
.
objects
.
get_current
)
self
.
assertRaises
(
ObjectDoesNotExist
,
Site
.
objects
.
get_current
)
...
@@ -57,7 +57,7 @@ class SitesFrameworkTests(TestCase):
...
@@ -57,7 +57,7 @@ class SitesFrameworkTests(TestCase):
"SERVER_PORT"
:
"80"
,
"SERVER_PORT"
:
"80"
,
}
}
site
=
get_current_site
(
request
)
site
=
get_current_site
(
request
)
self
.
assert
True
(
isinstance
(
site
,
Site
)
)
self
.
assert
IsInstance
(
site
,
Site
)
self
.
assertEqual
(
site
.
id
,
settings
.
SITE_ID
)
self
.
assertEqual
(
site
.
id
,
settings
.
SITE_ID
)
# Test that an exception is raised if the sites framework is installed
# Test that an exception is raised if the sites framework is installed
...
@@ -68,7 +68,7 @@ class SitesFrameworkTests(TestCase):
...
@@ -68,7 +68,7 @@ class SitesFrameworkTests(TestCase):
# A RequestSite is returned if the sites framework is not installed
# A RequestSite is returned if the sites framework is not installed
with
self
.
modify_settings
(
INSTALLED_APPS
=
{
'remove'
:
'django.contrib.sites'
}):
with
self
.
modify_settings
(
INSTALLED_APPS
=
{
'remove'
:
'django.contrib.sites'
}):
site
=
get_current_site
(
request
)
site
=
get_current_site
(
request
)
self
.
assert
True
(
isinstance
(
site
,
RequestSite
)
)
self
.
assert
IsInstance
(
site
,
RequestSite
)
self
.
assertEqual
(
site
.
name
,
"example.com"
)
self
.
assertEqual
(
site
.
name
,
"example.com"
)
def
test_domain_name_with_whitespaces
(
self
):
def
test_domain_name_with_whitespaces
(
self
):
...
...
django/test/testcases.py
Dosyayı görüntüle @
2791fbf5
...
@@ -620,8 +620,8 @@ class SimpleTestCase(unittest.TestCase):
...
@@ -620,8 +620,8 @@ class SimpleTestCase(unittest.TestCase):
# test that max_length and min_length are always accepted
# test that max_length and min_length are always accepted
if
issubclass
(
fieldclass
,
CharField
):
if
issubclass
(
fieldclass
,
CharField
):
field_kwargs
.
update
({
'min_length'
:
2
,
'max_length'
:
20
})
field_kwargs
.
update
({
'min_length'
:
2
,
'max_length'
:
20
})
self
.
assert
True
(
isi
nstance
(
fieldclass
(
*
field_args
,
**
field_kwargs
),
self
.
assert
IsI
nstance
(
fieldclass
(
*
field_args
,
**
field_kwargs
),
fieldclass
)
)
fieldclass
)
def
assertHTMLEqual
(
self
,
html1
,
html2
,
msg
=
None
):
def
assertHTMLEqual
(
self
,
html1
,
html2
,
msg
=
None
):
"""
"""
...
...
tests/backends/tests.py
Dosyayı görüntüle @
2791fbf5
...
@@ -646,7 +646,7 @@ class BackendTestCase(TestCase):
...
@@ -646,7 +646,7 @@ class BackendTestCase(TestCase):
Test that cursors can be used as a context manager
Test that cursors can be used as a context manager
"""
"""
with
connection
.
cursor
()
as
cursor
:
with
connection
.
cursor
()
as
cursor
:
self
.
assert
True
(
isinstance
(
cursor
,
CursorWrapper
)
)
self
.
assert
IsInstance
(
cursor
,
CursorWrapper
)
# Both InterfaceError and ProgrammingError seem to be used when
# Both InterfaceError and ProgrammingError seem to be used when
# accessing closed cursor (psycopg2 has InterfaceError, rest seem
# accessing closed cursor (psycopg2 has InterfaceError, rest seem
# to use ProgrammingError).
# to use ProgrammingError).
...
@@ -661,7 +661,7 @@ class BackendTestCase(TestCase):
...
@@ -661,7 +661,7 @@ class BackendTestCase(TestCase):
# psycopg2 offers us a way to check that by closed attribute.
# psycopg2 offers us a way to check that by closed attribute.
# So, run only on psycopg2 for that reason.
# So, run only on psycopg2 for that reason.
with
connection
.
cursor
()
as
cursor
:
with
connection
.
cursor
()
as
cursor
:
self
.
assert
True
(
isinstance
(
cursor
,
CursorWrapper
)
)
self
.
assert
IsInstance
(
cursor
,
CursorWrapper
)
self
.
assertTrue
(
cursor
.
closed
)
self
.
assertTrue
(
cursor
.
closed
)
...
...
tests/forms_tests/tests/test_forms.py
Dosyayı görüntüle @
2791fbf5
...
@@ -1908,7 +1908,7 @@ class FormsTestCase(TestCase):
...
@@ -1908,7 +1908,7 @@ class FormsTestCase(TestCase):
field
=
ChoicesField
()
field
=
ChoicesField
()
field2
=
copy
.
deepcopy
(
field
)
field2
=
copy
.
deepcopy
(
field
)
self
.
assert
True
(
isinstance
(
field2
,
ChoicesField
)
)
self
.
assert
IsInstance
(
field2
,
ChoicesField
)
self
.
assertFalse
(
id
(
field2
.
fields
)
==
id
(
field
.
fields
))
self
.
assertFalse
(
id
(
field2
.
fields
)
==
id
(
field
.
fields
))
self
.
assertFalse
(
id
(
field2
.
fields
[
0
]
.
choices
)
==
self
.
assertFalse
(
id
(
field2
.
fields
[
0
]
.
choices
)
==
id
(
field
.
fields
[
0
]
.
choices
))
id
(
field
.
fields
[
0
]
.
choices
))
...
@@ -2152,7 +2152,7 @@ class FormsTestCase(TestCase):
...
@@ -2152,7 +2152,7 @@ class FormsTestCase(TestCase):
e
.
append
(
'Foo'
)
e
.
append
(
'Foo'
)
e
.
append
(
ValidationError
(
'Foo
%(bar)
s'
,
code
=
'foobar'
,
params
=
{
'bar'
:
'bar'
}))
e
.
append
(
ValidationError
(
'Foo
%(bar)
s'
,
code
=
'foobar'
,
params
=
{
'bar'
:
'bar'
}))
self
.
assert
True
(
isinstance
(
e
,
list
)
)
self
.
assert
IsInstance
(
e
,
list
)
self
.
assertIn
(
'Foo'
,
e
)
self
.
assertIn
(
'Foo'
,
e
)
self
.
assertIn
(
'Foo'
,
forms
.
ValidationError
(
e
))
self
.
assertIn
(
'Foo'
,
forms
.
ValidationError
(
e
))
...
...
tests/model_fields/tests.py
Dosyayı görüntüle @
2791fbf5
...
@@ -298,7 +298,7 @@ class BooleanFieldTests(unittest.TestCase):
...
@@ -298,7 +298,7 @@ class BooleanFieldTests(unittest.TestCase):
# conversions are applied with an offset
# conversions are applied with an offset
b5
=
BooleanModel
.
objects
.
all
()
.
extra
(
b5
=
BooleanModel
.
objects
.
all
()
.
extra
(
select
=
{
'string_col'
:
'string'
})[
0
]
select
=
{
'string_col'
:
'string'
})[
0
]
self
.
assert
False
(
isinstance
(
b5
.
pk
,
bool
)
)
self
.
assert
NotIsInstance
(
b5
.
pk
,
bool
)
def
test_select_related
(
self
):
def
test_select_related
(
self
):
"""
"""
...
...
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