Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
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
cpython
Commits
7c389e24
Kaydet (Commit)
7c389e24
authored
Şub 08, 2014
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #20553. Use specific asserts in ipaddress tests.
üst
a7c07d32
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
18 deletions
+17
-18
test_ipaddress.py
Lib/test/test_ipaddress.py
+17
-18
No files found.
Lib/test/test_ipaddress.py
Dosyayı görüntüle @
7c389e24
...
@@ -921,13 +921,13 @@ class IpaddrUnitTest(unittest.TestCase):
...
@@ -921,13 +921,13 @@ class IpaddrUnitTest(unittest.TestCase):
36893488147419103232
)
36893488147419103232
)
def
testContains
(
self
):
def
testContains
(
self
):
self
.
assert
True
(
ipaddress
.
IPv4Interface
(
'1.2.3.128/25'
)
in
self
.
assert
In
(
ipaddress
.
IPv4Interface
(
'1.2.3.128/25'
),
self
.
ipv4_network
)
self
.
ipv4_network
)
self
.
assert
False
(
ipaddress
.
IPv4Interface
(
'1.2.4.1/24'
)
in
self
.
assert
NotIn
(
ipaddress
.
IPv4Interface
(
'1.2.4.1/24'
),
self
.
ipv4_network
)
self
.
ipv4_network
)
# We can test addresses and string as well.
# We can test addresses and string as well.
addr1
=
ipaddress
.
IPv4Address
(
'1.2.3.37'
)
addr1
=
ipaddress
.
IPv4Address
(
'1.2.3.37'
)
self
.
assert
True
(
addr1
in
self
.
ipv4_network
)
self
.
assert
In
(
addr1
,
self
.
ipv4_network
)
# issue 61, bad network comparison on like-ip'd network objects
# issue 61, bad network comparison on like-ip'd network objects
# with identical broadcast addresses.
# with identical broadcast addresses.
self
.
assertFalse
(
ipaddress
.
IPv4Network
(
'1.1.0.0/16'
)
.
__contains__
(
self
.
assertFalse
(
ipaddress
.
IPv4Network
(
'1.1.0.0/16'
)
.
__contains__
(
...
@@ -1500,8 +1500,8 @@ class IpaddrUnitTest(unittest.TestCase):
...
@@ -1500,8 +1500,8 @@ class IpaddrUnitTest(unittest.TestCase):
dummy
[
self
.
ipv6_address
]
=
None
dummy
[
self
.
ipv6_address
]
=
None
dummy
[
ip1
]
=
None
dummy
[
ip1
]
=
None
dummy
[
ip2
]
=
None
dummy
[
ip2
]
=
None
self
.
assert
True
(
self
.
ipv4_address
in
dummy
)
self
.
assert
In
(
self
.
ipv4_address
,
dummy
)
self
.
assert
True
(
ip2
in
dummy
)
self
.
assert
In
(
ip2
,
dummy
)
def
testIPBases
(
self
):
def
testIPBases
(
self
):
net
=
self
.
ipv4_network
net
=
self
.
ipv4_network
...
@@ -1608,9 +1608,9 @@ class IpaddrUnitTest(unittest.TestCase):
...
@@ -1608,9 +1608,9 @@ class IpaddrUnitTest(unittest.TestCase):
def
testNetworkElementCaching
(
self
):
def
testNetworkElementCaching
(
self
):
# V4 - make sure we're empty
# V4 - make sure we're empty
self
.
assert
False
(
'network_address'
in
self
.
ipv4_network
.
_cache
)
self
.
assert
NotIn
(
'network_address'
,
self
.
ipv4_network
.
_cache
)
self
.
assert
False
(
'broadcast_address'
in
self
.
ipv4_network
.
_cache
)
self
.
assert
NotIn
(
'broadcast_address'
,
self
.
ipv4_network
.
_cache
)
self
.
assert
False
(
'hostmask'
in
self
.
ipv4_network
.
_cache
)
self
.
assert
NotIn
(
'hostmask'
,
self
.
ipv4_network
.
_cache
)
# V4 - populate and test
# V4 - populate and test
self
.
assertEqual
(
self
.
ipv4_network
.
network_address
,
self
.
assertEqual
(
self
.
ipv4_network
.
network_address
,
...
@@ -1621,12 +1621,12 @@ class IpaddrUnitTest(unittest.TestCase):
...
@@ -1621,12 +1621,12 @@ class IpaddrUnitTest(unittest.TestCase):
ipaddress
.
IPv4Address
(
'0.0.0.255'
))
ipaddress
.
IPv4Address
(
'0.0.0.255'
))
# V4 - check we're cached
# V4 - check we're cached
self
.
assert
True
(
'broadcast_address'
in
self
.
ipv4_network
.
_cache
)
self
.
assert
In
(
'broadcast_address'
,
self
.
ipv4_network
.
_cache
)
self
.
assert
True
(
'hostmask'
in
self
.
ipv4_network
.
_cache
)
self
.
assert
In
(
'hostmask'
,
self
.
ipv4_network
.
_cache
)
# V6 - make sure we're empty
# V6 - make sure we're empty
self
.
assert
False
(
'broadcast_address'
in
self
.
ipv6_network
.
_cache
)
self
.
assert
NotIn
(
'broadcast_address'
,
self
.
ipv6_network
.
_cache
)
self
.
assert
False
(
'hostmask'
in
self
.
ipv6_network
.
_cache
)
self
.
assert
NotIn
(
'hostmask'
,
self
.
ipv6_network
.
_cache
)
# V6 - populate and test
# V6 - populate and test
self
.
assertEqual
(
self
.
ipv6_network
.
network_address
,
self
.
assertEqual
(
self
.
ipv6_network
.
network_address
,
...
@@ -1646,11 +1646,10 @@ class IpaddrUnitTest(unittest.TestCase):
...
@@ -1646,11 +1646,10 @@ class IpaddrUnitTest(unittest.TestCase):
ipaddress
.
IPv6Address
(
'::ffff:ffff:ffff:ffff'
))
ipaddress
.
IPv6Address
(
'::ffff:ffff:ffff:ffff'
))
# V6 - check we're cached
# V6 - check we're cached
self
.
assertTrue
(
'broadcast_address'
in
self
.
ipv6_network
.
_cache
)
self
.
assertIn
(
'broadcast_address'
,
self
.
ipv6_network
.
_cache
)
self
.
assertTrue
(
'hostmask'
in
self
.
ipv6_network
.
_cache
)
self
.
assertIn
(
'hostmask'
,
self
.
ipv6_network
.
_cache
)
self
.
assertTrue
(
self
.
assertIn
(
'broadcast_address'
,
self
.
ipv6_interface
.
network
.
_cache
)
'broadcast_address'
in
self
.
ipv6_interface
.
network
.
_cache
)
self
.
assertIn
(
'hostmask'
,
self
.
ipv6_interface
.
network
.
_cache
)
self
.
assertTrue
(
'hostmask'
in
self
.
ipv6_interface
.
network
.
_cache
)
def
testTeredo
(
self
):
def
testTeredo
(
self
):
# stolen from wikipedia
# stolen from wikipedia
...
...
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