mirror of
https://git.photon.obnh.io/AXSY/whois.git
synced 2026-03-15 02:43:39 +00:00
Initial commit: mwhois with SCION AS support and decimal AS conversion
Based on mwhois by Antonios A. Chariton Modifications for SCION AS support by Olaf Baumert, Axpo Systems AG
This commit is contained in:
107
netaddr/tests/2.x/core/compat.txt
Normal file
107
netaddr/tests/2.x/core/compat.txt
Normal file
@@ -0,0 +1,107 @@
|
||||
=Python 2.x and 3.x compatibility tests=
|
||||
|
||||
Copyright (c) 2008-2015, David P. D. Moss. All rights reserved.
|
||||
|
||||
{{{
|
||||
|
||||
>>> from netaddr.compat import _sys_maxint, _is_str, _is_int, _callable
|
||||
|
||||
>>> from netaddr.compat import _func_doc, _dict_keys, _dict_items
|
||||
|
||||
>>> from netaddr.compat import _iter_dict_keys, _bytes_join, _zip, _range
|
||||
|
||||
>>> from netaddr.compat import _iter_range, _func_name, _func_doc
|
||||
|
||||
# string and integer detection tests.
|
||||
>>> _is_int(_sys_maxint)
|
||||
True
|
||||
|
||||
>>> _is_str(_sys_maxint)
|
||||
False
|
||||
|
||||
>>> _is_str('')
|
||||
True
|
||||
|
||||
>>> _is_str(''.encode())
|
||||
True
|
||||
|
||||
>>> _is_str(unicode(''))
|
||||
True
|
||||
|
||||
# Python 2.x - 8 bit strings are just regular strings
|
||||
>>> str_8bit = _bytes_join(['a', 'b', 'c'])
|
||||
|
||||
>>> str_8bit == 'abc'.encode()
|
||||
True
|
||||
|
||||
>>> "'abc'" == '%r' % str_8bit
|
||||
True
|
||||
|
||||
# dict operation tests.
|
||||
>>> d = { 'a' : 0, 'b' : 1, 'c' : 2 }
|
||||
|
||||
>>> sorted(_dict_keys(d)) == ['a', 'b', 'c']
|
||||
True
|
||||
|
||||
>>> sorted(_dict_items(d)) == [('a', 0), ('b', 1), ('c', 2)]
|
||||
True
|
||||
|
||||
# zip() BIF tests.
|
||||
>>> l2 = _zip([0], [1])
|
||||
|
||||
>>> hasattr(_zip(l2), 'pop')
|
||||
True
|
||||
|
||||
>>> l2 == [(0, 1)]
|
||||
True
|
||||
|
||||
# range/xrange() tests.
|
||||
>>> l1 = _range(3)
|
||||
|
||||
>>> isinstance(l1, list)
|
||||
True
|
||||
|
||||
>>> hasattr(l1, 'pop')
|
||||
True
|
||||
|
||||
>>> l1 == [0, 1, 2]
|
||||
True
|
||||
|
||||
>>> it = _iter_range(3)
|
||||
|
||||
>>> isinstance(it, list)
|
||||
False
|
||||
|
||||
>>> hasattr(it, '__iter__')
|
||||
True
|
||||
|
||||
>>> it == [0, 1, 2]
|
||||
False
|
||||
|
||||
>>> list(it) == [0, 1, 2]
|
||||
True
|
||||
|
||||
# callable() and function meta-data tests.
|
||||
>>> i = 1
|
||||
>>> def f1():
|
||||
... """docstring"""
|
||||
... pass
|
||||
|
||||
>>> f2 = lambda x: x
|
||||
|
||||
>>> _callable(i)
|
||||
False
|
||||
|
||||
>>> _callable(f1)
|
||||
True
|
||||
|
||||
>>> _callable(f2)
|
||||
True
|
||||
|
||||
>>> _func_name(f1) == 'f1'
|
||||
True
|
||||
|
||||
>>> _func_doc(f1) == 'docstring'
|
||||
True
|
||||
|
||||
}}}
|
||||
Reference in New Issue
Block a user