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
478a6931
Kaydet (Commit)
478a6931
authored
Agu 14, 2012
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[py3] Fixed uses of __metaclass__ in tests.
üst
450c0df6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
13 deletions
+8
-13
fields.py
tests/modeltests/custom_pk/fields.py
+1
-2
fields.py
tests/modeltests/field_subclassing/fields.py
+2
-4
models.py
tests/modeltests/serializers/models.py
+1
-2
tests.py
tests/regressiontests/introspection/tests.py
+2
-2
tests.py
tests/regressiontests/model_forms_regress/tests.py
+2
-3
No files found.
tests/modeltests/custom_pk/fields.py
Dosyayı görüntüle @
478a6931
...
...
@@ -22,8 +22,7 @@ class MyWrapper(object):
return
self
.
value
==
other
.
value
return
self
.
value
==
other
class
MyAutoField
(
models
.
CharField
):
__metaclass__
=
models
.
SubfieldBase
class
MyAutoField
(
six
.
with_metaclass
(
models
.
SubfieldBase
,
models
.
CharField
)):
def
__init__
(
self
,
*
args
,
**
kwargs
):
kwargs
[
'max_length'
]
=
10
...
...
tests/modeltests/field_subclassing/fields.py
Dosyayı görüntüle @
478a6931
...
...
@@ -20,13 +20,12 @@ class Small(object):
def
__str__
(
self
):
return
'
%
s
%
s'
%
(
force_text
(
self
.
first
),
force_text
(
self
.
second
))
class
SmallField
(
models
.
Field
):
class
SmallField
(
six
.
with_metaclass
(
models
.
SubfieldBase
,
models
.
Field
)
):
"""
Turns the "Small" class into a Django field. Because of the similarities
with normal character fields and the fact that Small.__unicode__ does
something sensible, we don't need to implement a lot here.
"""
__metaclass__
=
models
.
SubfieldBase
def
__init__
(
self
,
*
args
,
**
kwargs
):
kwargs
[
'max_length'
]
=
2
...
...
@@ -56,8 +55,7 @@ class SmallerField(SmallField):
pass
class
JSONField
(
models
.
TextField
):
__metaclass__
=
models
.
SubfieldBase
class
JSONField
(
six
.
with_metaclass
(
models
.
SubfieldBase
,
models
.
TextField
)):
description
=
(
"JSONField automatically serializes and desializes values to "
"and from JSON."
)
...
...
tests/modeltests/serializers/models.py
Dosyayı görüntüle @
478a6931
...
...
@@ -99,8 +99,7 @@ class Team(object):
return
"
%
s"
%
self
.
title
class
TeamField
(
models
.
CharField
):
__metaclass__
=
models
.
SubfieldBase
class
TeamField
(
six
.
with_metaclass
(
models
.
SubfieldBase
,
models
.
CharField
)):
def
__init__
(
self
):
super
(
TeamField
,
self
)
.
__init__
(
max_length
=
100
)
...
...
tests/regressiontests/introspection/tests.py
Dosyayı görüntüle @
478a6931
...
...
@@ -4,6 +4,7 @@ from functools import update_wrapper
from
django.db
import
connection
from
django.test
import
TestCase
,
skipUnlessDBFeature
,
skipIfDBFeature
from
django.utils
import
six
from
.models
import
Reporter
,
Article
...
...
@@ -35,8 +36,7 @@ class IgnoreNotimplementedError(type):
attrs
[
k
]
=
ignore_not_implemented
(
v
)
return
type
.
__new__
(
cls
,
name
,
bases
,
attrs
)
class
IntrospectionTests
(
TestCase
):
__metaclass__
=
IgnoreNotimplementedError
class
IntrospectionTests
(
six
.
with_metaclass
(
IgnoreNotimplementedError
,
TestCase
)):
def
test_table_names
(
self
):
tl
=
connection
.
introspection
.
table_names
()
...
...
tests/regressiontests/model_forms_regress/tests.py
Dosyayı görüntüle @
478a6931
...
...
@@ -485,9 +485,8 @@ class CustomMetaclass(ModelFormMetaclass):
new
.
base_fields
=
{}
return
new
class
CustomMetaclassForm
(
forms
.
ModelForm
):
__metaclass__
=
CustomMetaclass
class
CustomMetaclassForm
(
six
.
with_metaclass
(
CustomMetaclass
,
forms
.
ModelForm
)):
pass
class
CustomMetaclassTestCase
(
TestCase
):
def
test_modelform_factory_metaclass
(
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