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
ce69a421
Kaydet (Commit)
ce69a421
authored
Şub 04, 2017
tarafından
Mads Jensen
Kaydeden (comit)
Tim Graham
Şub 04, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added tests for various __repr__() methods.
üst
2d899ce1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
1 deletion
+69
-1
test_graph.py
tests/migrations/test_graph.py
+28
-1
test_trans.py
tests/template_tests/syntax_tests/i18n/test_trans.py
+7
-0
test_extends.py
tests/template_tests/syntax_tests/test_extends.py
+13
-0
test_if.py
tests/template_tests/syntax_tests/test_if.py
+7
-0
test_if_equal.py
tests/template_tests/syntax_tests/test_if_equal.py
+7
-0
test_with.py
tests/template_tests/syntax_tests/test_with.py
+7
-0
No files found.
tests/migrations/test_graph.py
Dosyayı görüntüle @
ce69a421
...
...
@@ -3,7 +3,9 @@ import warnings
from
django.db.migrations.exceptions
import
(
CircularDependencyError
,
NodeNotFoundError
,
)
from
django.db.migrations.graph
import
RECURSION_DEPTH_WARNING
,
MigrationGraph
from
django.db.migrations.graph
import
(
RECURSION_DEPTH_WARNING
,
DummyNode
,
MigrationGraph
,
Node
,
)
from
django.test
import
SimpleTestCase
...
...
@@ -407,3 +409,28 @@ class GraphTests(SimpleTestCase):
self
.
assertEqual
(
str
(
graph
),
"Graph: 5 nodes, 3 edges"
)
self
.
assertEqual
(
repr
(
graph
),
"<MigrationGraph: nodes=5, edges=3>"
)
class
NodeTests
(
SimpleTestCase
):
def
test_node_repr
(
self
):
node
=
Node
((
'app_a'
,
'0001'
))
self
.
assertEqual
(
repr
(
node
),
"<Node: ('app_a', '0001')>"
)
def
test_dummynode_repr
(
self
):
node
=
DummyNode
(
key
=
(
'app_a'
,
'0001'
),
origin
=
'app_a.0001'
,
error_message
=
'x is missing'
,
)
self
.
assertEqual
(
repr
(
node
),
"<DummyNode: ('app_a', '0001')>"
)
def
test_dummynode_promote
(
self
):
dummy
=
DummyNode
(
key
=
(
'app_a'
,
'0001'
),
origin
=
'app_a.0002'
,
error_message
=
"app_a.0001 (req'd by app_a.0002) is missing!"
,
)
dummy
.
promote
()
self
.
assertIsInstance
(
dummy
,
Node
)
self
.
assertFalse
(
hasattr
(
dummy
,
'origin'
))
self
.
assertFalse
(
hasattr
(
dummy
,
'error_message'
))
tests/template_tests/syntax_tests/i18n/test_trans.py
Dosyayı görüntüle @
ce69a421
from
threading
import
local
from
django.template
import
Context
,
Template
,
TemplateSyntaxError
from
django.templatetags.l10n
import
LocalizeNode
from
django.test
import
SimpleTestCase
,
override_settings
from
django.utils
import
translation
from
django.utils.safestring
import
mark_safe
...
...
@@ -203,3 +204,9 @@ class MultipleLocaleActivationTransTagTests(MultipleLocaleActivationTestCase):
t
=
Template
(
"{
%
load i18n
%
}{
%
trans 'No'
%
}"
)
with
translation
.
override
(
'nl'
):
self
.
assertEqual
(
t
.
render
(
Context
({})),
'Nee'
)
class
LocalizeNodeTests
(
SimpleTestCase
):
def
test_repr
(
self
):
node
=
LocalizeNode
(
nodelist
=
[],
use_l10n
=
True
)
self
.
assertEqual
(
repr
(
node
),
'<LocalizeNode>'
)
tests/template_tests/syntax_tests/test_extends.py
Dosyayı görüntüle @
ce69a421
from
django.template
import
NodeList
from
django.template.base
import
Node
from
django.template.loader_tags
import
ExtendsNode
from
django.test
import
SimpleTestCase
from
..utils
import
setup
...
...
@@ -396,3 +399,13 @@ class InheritanceTests(SimpleTestCase):
"""
output
=
self
.
engine
.
render_to_string
(
'inheritance42'
)
self
.
assertEqual
(
output
,
'1234'
)
class
ExtendsNodeTests
(
SimpleTestCase
):
def
test_extends_node_repr
(
self
):
extends_node
=
ExtendsNode
(
nodelist
=
NodeList
([]),
parent_name
=
Node
(),
template_dirs
=
[],
)
self
.
assertEqual
(
repr
(
extends_node
),
'<ExtendsNode: extends None>'
)
tests/template_tests/syntax_tests/test_if.py
Dosyayı görüntüle @
ce69a421
from
django.template
import
TemplateSyntaxError
from
django.template.defaulttags
import
IfNode
from
django.test
import
SimpleTestCase
from
..utils
import
TestObj
,
setup
...
...
@@ -599,3 +600,9 @@ class IfTagTests(SimpleTestCase):
def
test_if_is_not_both_variables_missing
(
self
):
output
=
self
.
engine
.
render_to_string
(
'template'
,
{})
self
.
assertEqual
(
output
,
'no'
)
class
IfNodeTests
(
SimpleTestCase
):
def
test_repr
(
self
):
node
=
IfNode
(
conditions_nodelists
=
[])
self
.
assertEqual
(
repr
(
node
),
'<IfNode>'
)
tests/template_tests/syntax_tests/test_if_equal.py
Dosyayı görüntüle @
ce69a421
from
django.template.defaulttags
import
IfEqualNode
from
django.test
import
SimpleTestCase
from
..utils
import
setup
...
...
@@ -215,3 +216,9 @@ class IfNotEqualTagTests(SimpleTestCase):
def
test_ifnotequal04
(
self
):
output
=
self
.
engine
.
render_to_string
(
'ifnotequal04'
,
{
'a'
:
1
,
'b'
:
1
})
self
.
assertEqual
(
output
,
'no'
)
class
IfEqualTests
(
SimpleTestCase
):
def
test_repr
(
self
):
node
=
IfEqualNode
(
var1
=
'a'
,
var2
=
'b'
,
nodelist_true
=
[],
nodelist_false
=
[],
negate
=
False
)
self
.
assertEqual
(
repr
(
node
),
'<IfEqualNode>'
)
tests/template_tests/syntax_tests/test_with.py
Dosyayı görüntüle @
ce69a421
from
django.template
import
TemplateSyntaxError
from
django.template.defaulttags
import
WithNode
from
django.test
import
SimpleTestCase
from
..utils
import
setup
...
...
@@ -50,3 +51,9 @@ class WithTagTests(SimpleTestCase):
def
test_with_error02
(
self
):
with
self
.
assertRaises
(
TemplateSyntaxError
):
self
.
engine
.
render_to_string
(
'with-error02'
,
{
'dict'
:
{
'key'
:
50
}})
class
WithNodeTests
(
SimpleTestCase
):
def
test_repr
(
self
):
node
=
WithNode
(
nodelist
=
[],
name
=
'a'
,
var
=
'dict.key'
)
self
.
assertEqual
(
repr
(
node
),
'<WithNode>'
)
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