Skip to content

Commit 5086473

Browse files
committed
add modules
1 parent b53c0e9 commit 5086473

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

test_netaddr/test_netaddr.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import netaddr
2+
3+
ip = netaddr.IPAddress('10.0.2.15')
4+
print ip.version
5+
print repr(ip)
6+
print ip
7+
8+
print str(ip)
9+
print ip.format()
10+
print int(ip)
11+
print hex(ip)
12+
13+
ip = netaddr.IPNetwork('10.0.2.15/20')
14+
print ip.network, ip.broadcast
15+
print ip.netmask, ip.hostmask
16+
print ip.size
17+
print ip.ip.bits()
18+
print ip.network.bits()
19+
print ip.netmask.bits()
20+
print ip.broadcast.bits()
21+
list_ip = list(ip)
22+
print len(list_ip)

test_six/test_abc.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import six
2+
import abc
3+
4+
@six.add_metaclass(abc.ABCMeta)
5+
class test(object):
6+
@abc.abstractmethod
7+
def func(self):
8+
pass
9+
10+
class sub_test(test):
11+
def __init__(self):
12+
print 'aaaa'
13+
def func(self):
14+
print 'success'
15+
16+
mm = sub_test()

test_six/test_six.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import sys
2+
import six
3+
import abc
4+
5+
PY2 = sys.version_info[0] == 2
6+
PY3 = sys.version_info[0] == 3
7+
PY34 = sys.version_info[0:2] >= (3, 4)
8+
9+
if sys.platform.startswith('linux'):
10+
print 'linux'
11+
12+
if six.PY2:
13+
print 'The version of the python is 2'
14+
15+
@six.add_metaclass(abc.ABCMeta)
16+
class test(object):
17+
def __init__(self):
18+
print 'test metaclass'
19+
20+
sub_test = test()
21+
print type(test)
22+
print type(sub_test)
23+
# print issubclass(sub_test, test)

0 commit comments

Comments
 (0)