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
d91321e8
Kaydet (Commit)
d91321e8
authored
Nis 27, 2015
tarafından
Alasdair Nicol
Kaydeden (comit)
Tim Graham
Nis 27, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Used assertIsInstance in tests.
üst
40768ec2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
14 deletions
+15
-14
tests.py
tests/datatypes/tests.py
+2
-1
tests.py
tests/defer_regress/tests.py
+2
-2
tests.py
tests/dispatch/tests.py
+1
-1
test_fields.py
tests/forms_tests/tests/test_fields.py
+5
-5
test_forms.py
tests/forms_tests/tests/test_forms.py
+1
-1
test_ds.py
tests/gis_tests/gdal_tests/test_ds.py
+2
-2
test_imagefield.py
tests/model_fields/test_imagefield.py
+2
-2
No files found.
tests/datatypes/tests.py
Dosyayı görüntüle @
d91321e8
...
...
@@ -93,4 +93,5 @@ class DataTypesTestCase(TestCase):
self
.
assertIsInstance
(
b
.
baked_timestamp
,
datetime
.
datetime
)
# We need to test this way because datetime.datetime inherits
# from datetime.date:
self
.
assertIsInstance
(
b
.
baked_date
,
datetime
.
date
)
and
not
isinstance
(
b
.
baked_date
,
datetime
.
datetime
)
self
.
assertIsInstance
(
b
.
baked_date
,
datetime
.
date
)
self
.
assertNotIsInstance
(
b
.
baked_date
,
datetime
.
datetime
)
tests/defer_regress/tests.py
Dosyayı görüntüle @
d91321e8
...
...
@@ -256,8 +256,8 @@ class DeferRegressionTest(TestCase):
deferred_item1
=
deferred_class_factory
(
Item
,
(
'name'
,))
deferred_item2
=
deferred_class_factory
(
deferred_item1
,
(
'value'
,))
self
.
assertIs
(
deferred_item2
.
_meta
.
proxy_for_model
,
Item
)
self
.
assert
False
(
isinstance
(
deferred_item2
.
__dict__
.
get
(
'name'
),
DeferredAttribute
)
)
self
.
assert
True
(
isinstance
(
deferred_item2
.
__dict__
.
get
(
'value'
),
DeferredAttribute
)
)
self
.
assert
NotIsInstance
(
deferred_item2
.
__dict__
.
get
(
'name'
),
DeferredAttribute
)
self
.
assert
IsInstance
(
deferred_item2
.
__dict__
.
get
(
'value'
),
DeferredAttribute
)
def
test_deferred_class_factory_no_attrs
(
self
):
deferred_cls
=
deferred_class_factory
(
Item
,
())
...
...
tests/dispatch/tests.py
Dosyayı görüntüle @
d91321e8
...
...
@@ -135,7 +135,7 @@ class DispatcherTests(unittest.TestCase):
self
.
assertIsInstance
(
err
,
ValueError
)
self
.
assertEqual
(
err
.
args
,
(
'this'
,))
self
.
assertTrue
(
hasattr
(
err
,
'__traceback__'
))
self
.
assert
True
(
isinstance
(
err
.
__traceback__
,
TracebackType
)
)
self
.
assert
IsInstance
(
err
.
__traceback__
,
TracebackType
)
a_signal
.
disconnect
(
fails
)
self
.
assertTestIsClean
(
a_signal
)
...
...
tests/forms_tests/tests/test_fields.py
Dosyayı görüntüle @
d91321e8
...
...
@@ -172,7 +172,7 @@ class FieldsTests(SimpleTestCase):
self
.
assertRaisesMessage
(
ValidationError
,
"'This field is required.'"
,
f
.
clean
,
''
)
self
.
assertRaisesMessage
(
ValidationError
,
"'This field is required.'"
,
f
.
clean
,
None
)
self
.
assertEqual
(
1
,
f
.
clean
(
'1'
))
self
.
assert
Equal
(
True
,
isinstance
(
f
.
clean
(
'1'
),
int
)
)
self
.
assert
IsInstance
(
f
.
clean
(
'1'
),
int
)
self
.
assertEqual
(
23
,
f
.
clean
(
'23'
))
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a whole number.'"
,
f
.
clean
,
'a'
)
self
.
assertEqual
(
42
,
f
.
clean
(
42
))
...
...
@@ -191,7 +191,7 @@ class FieldsTests(SimpleTestCase):
self
.
assertEqual
(
None
,
f
.
clean
(
None
))
self
.
assertEqual
(
'None'
,
repr
(
f
.
clean
(
None
)))
self
.
assertEqual
(
1
,
f
.
clean
(
'1'
))
self
.
assert
Equal
(
True
,
isinstance
(
f
.
clean
(
'1'
),
int
)
)
self
.
assert
IsInstance
(
f
.
clean
(
'1'
),
int
)
self
.
assertEqual
(
23
,
f
.
clean
(
'23'
))
self
.
assertRaisesMessage
(
ValidationError
,
"'Enter a whole number.'"
,
f
.
clean
,
'a'
)
self
.
assertEqual
(
1
,
f
.
clean
(
'1 '
))
...
...
@@ -283,7 +283,7 @@ class FieldsTests(SimpleTestCase):
self
.
assertRaisesMessage
(
ValidationError
,
"'This field is required.'"
,
f
.
clean
,
''
)
self
.
assertRaisesMessage
(
ValidationError
,
"'This field is required.'"
,
f
.
clean
,
None
)
self
.
assertEqual
(
1.0
,
f
.
clean
(
'1'
))
self
.
assert
Equal
(
True
,
isinstance
(
f
.
clean
(
'1'
),
float
)
)
self
.
assert
IsInstance
(
f
.
clean
(
'1'
),
float
)
self
.
assertEqual
(
23.0
,
f
.
clean
(
'23'
))
self
.
assertEqual
(
3.1400000000000001
,
f
.
clean
(
'3.14'
))
self
.
assertEqual
(
3.1400000000000001
,
f
.
clean
(
3.14
))
...
...
@@ -347,7 +347,7 @@ class FieldsTests(SimpleTestCase):
self
.
assertRaisesMessage
(
ValidationError
,
"'This field is required.'"
,
f
.
clean
,
''
)
self
.
assertRaisesMessage
(
ValidationError
,
"'This field is required.'"
,
f
.
clean
,
None
)
self
.
assertEqual
(
f
.
clean
(
'1'
),
Decimal
(
"1"
))
self
.
assert
Equal
(
True
,
isinstance
(
f
.
clean
(
'1'
),
Decimal
)
)
self
.
assert
IsInstance
(
f
.
clean
(
'1'
),
Decimal
)
self
.
assertEqual
(
f
.
clean
(
'23'
),
Decimal
(
"23"
))
self
.
assertEqual
(
f
.
clean
(
'3.14'
),
Decimal
(
"3.14"
))
self
.
assertEqual
(
f
.
clean
(
3.14
),
Decimal
(
"3.14"
))
...
...
@@ -1389,7 +1389,7 @@ class FieldsTests(SimpleTestCase):
def
test_splitdatetimefield_1
(
self
):
from
django.forms.widgets
import
SplitDateTimeWidget
f
=
SplitDateTimeField
()
assert
isi
nstance
(
f
.
widget
,
SplitDateTimeWidget
)
self
.
assertIsI
nstance
(
f
.
widget
,
SplitDateTimeWidget
)
self
.
assertEqual
(
datetime
.
datetime
(
2006
,
1
,
10
,
7
,
30
),
f
.
clean
([
datetime
.
date
(
2006
,
1
,
10
),
datetime
.
time
(
7
,
30
)]))
self
.
assertRaisesMessage
(
ValidationError
,
"'This field is required.'"
,
f
.
clean
,
None
)
self
.
assertRaisesMessage
(
ValidationError
,
"'This field is required.'"
,
f
.
clean
,
''
)
...
...
tests/forms_tests/tests/test_forms.py
Dosyayı görüntüle @
d91321e8
...
...
@@ -775,7 +775,7 @@ class FormsTestCase(TestCase):
self
.
assertFalse
(
form
.
is_valid
())
# Check that update_error_dict didn't lose track of the ErrorDict type.
self
.
assert
True
(
isinstance
(
form
.
_errors
,
forms
.
ErrorDict
)
)
self
.
assert
IsInstance
(
form
.
_errors
,
forms
.
ErrorDict
)
self
.
assertEqual
(
dict
(
form
.
errors
),
{
'code'
:
[
'Code error 1.'
,
'Code error 2.'
,
'Code error 3.'
],
...
...
tests/gis_tests/gdal_tests/test_ds.py
Dosyayı görüntüle @
d91321e8
...
...
@@ -109,7 +109,7 @@ class DataSourceTest(unittest.TestCase):
# http://trac.osgeo.org/gdal/ticket/3783
pass
else
:
self
.
assert
Equal
(
True
,
isinstance
(
layer
.
extent
,
Envelope
)
)
self
.
assert
IsInstance
(
layer
.
extent
,
Envelope
)
self
.
assertAlmostEqual
(
source
.
extent
[
0
],
layer
.
extent
.
min_x
,
5
)
self
.
assertAlmostEqual
(
source
.
extent
[
1
],
layer
.
extent
.
min_y
,
5
)
self
.
assertAlmostEqual
(
source
.
extent
[
2
],
layer
.
extent
.
max_x
,
5
)
...
...
@@ -195,7 +195,7 @@ class DataSourceTest(unittest.TestCase):
for
k
,
v
in
source
.
fields
.
items
():
# Making sure we get the proper OGR Field instance, using
# a string value index for the feature.
self
.
assert
Equal
(
True
,
isinstance
(
feat
[
k
],
v
)
)
self
.
assert
IsInstance
(
feat
[
k
],
v
)
# Testing Feature.__iter__
for
fld
in
feat
:
...
...
tests/model_fields/test_imagefield.py
Dosyayı görüntüle @
d91321e8
...
...
@@ -205,7 +205,7 @@ class ImageFieldTwoDimensionsTests(ImageFieldTestMixin, TestCase):
# TestImageField value will default to being an instance of its
# attr_class, a TestImageFieldFile, with name == None, which will
# cause it to evaluate as False.
self
.
assert
Equal
(
isinstance
(
p
.
mugshot
,
TestImageFieldFile
),
Tru
e
)
self
.
assert
IsInstance
(
p
.
mugshot
,
TestImageFieldFil
e
)
self
.
assertEqual
(
bool
(
p
.
mugshot
),
False
)
# Test setting a fresh created model instance.
...
...
@@ -227,7 +227,7 @@ class ImageFieldTwoDimensionsTests(ImageFieldTestMixin, TestCase):
name (name set to None).
"""
p
=
self
.
PersonModel
()
self
.
assert
Equal
(
isinstance
(
p
.
mugshot
,
TestImageFieldFile
),
Tru
e
)
self
.
assert
IsInstance
(
p
.
mugshot
,
TestImageFieldFil
e
)
self
.
assertEqual
(
bool
(
p
.
mugshot
),
False
)
def
test_assignment_to_None
(
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