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
2eefbca1
Kaydet (Commit)
2eefbca1
authored
Kas 12, 2015
tarafından
Simon Charette
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #25745 -- Isolated a foreign_object test.
üst
406de4c2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
tests.py
tests/foreign_object/tests.py
+13
-0
No files found.
tests/foreign_object/tests.py
Dosyayı görüntüle @
2eefbca1
import
datetime
from
operator
import
attrgetter
from
django.apps.registry
import
Apps
from
django.core.exceptions
import
FieldError
from
django.db
import
models
from
django.db.models.fields.related
import
ForeignObject
...
...
@@ -398,11 +399,14 @@ class MultiColumnFKTests(TestCase):
class
TestModelCheckTests
(
SimpleTestCase
):
def
test_check_composite_foreign_object
(
self
):
test_apps
=
Apps
([
'foreign_object'
])
class
Parent
(
models
.
Model
):
a
=
models
.
PositiveIntegerField
()
b
=
models
.
PositiveIntegerField
()
class
Meta
:
apps
=
test_apps
unique_together
=
((
'a'
,
'b'
),)
class
Child
(
models
.
Model
):
...
...
@@ -417,15 +421,21 @@ class TestModelCheckTests(SimpleTestCase):
related_name
=
'children'
,
)
class
Meta
:
apps
=
test_apps
self
.
assertEqual
(
Child
.
_meta
.
get_field
(
'parent'
)
.
check
(
from_model
=
Child
),
[])
def
test_check_subset_composite_foreign_object
(
self
):
test_apps
=
Apps
([
'foreign_object'
])
class
Parent
(
models
.
Model
):
a
=
models
.
PositiveIntegerField
()
b
=
models
.
PositiveIntegerField
()
c
=
models
.
PositiveIntegerField
()
class
Meta
:
apps
=
test_apps
unique_together
=
((
'a'
,
'b'
),)
class
Child
(
models
.
Model
):
...
...
@@ -441,4 +451,7 @@ class TestModelCheckTests(SimpleTestCase):
related_name
=
'children'
,
)
class
Meta
:
apps
=
test_apps
self
.
assertEqual
(
Child
.
_meta
.
get_field
(
'parent'
)
.
check
(
from_model
=
Child
),
[])
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