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
61e7fbf2
Kaydet (Commit)
61e7fbf2
authored
Haz 02, 2009
tarafından
Gregory P. Smith
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixes issue6169: it was possible for two ipaddr network addresses to compare
as both < and > than eachother.
üst
25de0dd8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
19 deletions
+30
-19
ipaddr.py
Lib/ipaddr.py
+15
-7
test_ipaddr.py
Lib/test/test_ipaddr.py
+15
-12
No files found.
Lib/ipaddr.py
Dosyayı görüntüle @
61e7fbf2
...
@@ -10,7 +10,7 @@ and prefixes.
...
@@ -10,7 +10,7 @@ and prefixes.
"""
"""
__version__
=
'1.1.
0
'
__version__
=
'1.1.
1
'
import
struct
import
struct
...
@@ -204,17 +204,25 @@ class BaseIP(object):
...
@@ -204,17 +204,25 @@ class BaseIP(object):
def
__lt__
(
self
,
other
):
def
__lt__
(
self
,
other
):
try
:
try
:
return
(
self
.
version
<
other
.
version
if
self
.
version
!=
other
.
version
:
or
self
.
ip
<
other
.
ip
return
self
.
version
<
other
.
version
or
self
.
netmask
<
other
.
netmask
)
if
self
.
ip
!=
other
.
ip
:
return
self
.
ip
<
other
.
ip
if
self
.
netmask
!=
other
.
netmask
:
return
self
.
netmask
<
other
.
netmask
return
False
except
AttributeError
:
except
AttributeError
:
return
NotImplemented
return
NotImplemented
def
__gt__
(
self
,
other
):
def
__gt__
(
self
,
other
):
try
:
try
:
return
(
self
.
version
>
other
.
version
if
self
.
version
!=
other
.
version
:
or
self
.
ip
>
other
.
ip
return
self
.
version
>
other
.
version
or
self
.
netmask
>
other
.
netmask
)
if
self
.
ip
!=
other
.
ip
:
return
self
.
ip
>
other
.
ip
if
self
.
netmask
!=
other
.
netmask
:
return
self
.
netmask
>
other
.
netmask
return
False
except
AttributeError
:
except
AttributeError
:
return
NotImplemented
return
NotImplemented
...
...
Lib/test/test_ipaddr.py
Dosyayı görüntüle @
61e7fbf2
# Copyright 2007 Google Inc.
# Copyright 2007 Google Inc.
# Licensed to PSF under a Contributor Agreement.
# Licensed to PSF under a Contributor Agreement.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# See also: http://code.google.com/p/ipaddr-py/
# See also: http://code.google.com/p/ipaddr-py/
"""Unittest for ipaddr module."""
"""Unittest for ipaddr module."""
...
@@ -373,6 +361,21 @@ class IpaddrUnitTest(unittest.TestCase):
...
@@ -373,6 +361,21 @@ class IpaddrUnitTest(unittest.TestCase):
self
.
assertTrue
(
ipv6
>
ipv4
)
self
.
assertTrue
(
ipv6
>
ipv4
)
self
.
assertTrue
(
ipv4
<
ipv6
)
self
.
assertTrue
(
ipv4
<
ipv6
)
# Regression test for issue6169 (ipaddr-py issue 19)
ip1
=
ipaddr
.
IP
(
'10.1.2.128/25'
)
self
.
assertFalse
(
ip1
<
ip1
)
self
.
assertFalse
(
ip1
>
ip1
)
ip2
=
ipaddr
.
IP
(
'10.1.3.0/24'
)
self
.
assertTrue
(
ip1
<
ip2
)
self
.
assertFalse
(
ip2
<
ip1
)
self
.
assertFalse
(
ip1
>
ip2
)
self
.
assertTrue
(
ip2
>
ip1
)
ip3
=
ipaddr
.
IP
(
'10.1.3.0/25'
)
self
.
assertTrue
(
ip2
<
ip3
)
self
.
assertFalse
(
ip3
<
ip2
)
self
.
assertFalse
(
ip2
>
ip3
)
self
.
assertTrue
(
ip3
>
ip2
)
def
test_embedded_ipv4
(
self
):
def
test_embedded_ipv4
(
self
):
ipv4_string
=
'192.168.0.1'
ipv4_string
=
'192.168.0.1'
ipv4
=
ipaddr
.
IPv4
(
ipv4_string
)
ipv4
=
ipaddr
.
IPv4
(
ipv4_string
)
...
...
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