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
626fa288
Kaydet (Commit)
626fa288
authored
Tem 07, 2013
tarafından
Alex Gaynor
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #13813 -- Comparison of DatabaseWrappers doesn't raise errors.
Patch from Lukasz Balcerzak.
üst
db2727f9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
1 deletion
+39
-1
__init__.py
django/db/backends/__init__.py
+3
-1
__init__.py
tests/db_backends/__init__.py
+0
-0
tests.py
tests/db_backends/tests.py
+36
-0
No files found.
django/db/backends/__init__.py
Dosyayı görüntüle @
626fa288
...
@@ -70,7 +70,9 @@ class BaseDatabaseWrapper(object):
...
@@ -70,7 +70,9 @@ class BaseDatabaseWrapper(object):
self
.
_thread_ident
=
thread
.
get_ident
()
self
.
_thread_ident
=
thread
.
get_ident
()
def
__eq__
(
self
,
other
):
def
__eq__
(
self
,
other
):
return
self
.
alias
==
other
.
alias
if
isinstance
(
other
,
BaseDatabaseWrapper
):
return
self
.
alias
==
other
.
alias
return
NotImplemented
def
__ne__
(
self
,
other
):
def
__ne__
(
self
,
other
):
return
not
self
==
other
return
not
self
==
other
...
...
tests/db_backends/__init__.py
0 → 100644
Dosyayı görüntüle @
626fa288
tests/db_backends/tests.py
0 → 100644
Dosyayı görüntüle @
626fa288
from
django.test
import
TestCase
from
django.db.backends
import
BaseDatabaseWrapper
class
DummyDatabaseWrapper
(
BaseDatabaseWrapper
):
pass
class
DummyObject
(
object
):
alias
=
None
class
DbBackendTests
(
TestCase
):
def
test_compare_db_wrapper_with_another_object
(
self
):
wrapper
=
BaseDatabaseWrapper
({})
self
.
assertFalse
(
wrapper
==
'not-a-db-wrapper'
)
def
test_compare_db_wrapper_with_another_object_with_alias
(
self
):
wrapper
=
BaseDatabaseWrapper
({})
obj
=
DummyObject
()
obj
.
alias
=
wrapper
.
alias
=
'foobar'
self
.
assertFalse
(
wrapper
==
obj
)
def
test_negate_compare_db_wrapper_with_another_object
(
self
):
wrapper
=
BaseDatabaseWrapper
({})
self
.
assertTrue
(
wrapper
!=
'not-a-db-wrapper'
)
def
test_compare_db_wrappers
(
self
):
wrapper1
=
DummyDatabaseWrapper
({})
wrapper2
=
BaseDatabaseWrapper
({})
wrapper1
.
alias
=
wrapper2
.
alias
=
'foo'
self
.
assertTrue
(
wrapper1
==
wrapper2
)
wrapper1
.
alias
=
'bar'
self
.
assertFalse
(
wrapper1
==
wrapper2
)
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