/usr/lib/python3/dist-packages/pyutilib/misc/tests/test_cross.py is in python3-pyutilib 5.3.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #
# Unit Tests for util/math
#
#
from os.path import abspath, dirname
pkgdir = dirname(abspath(__file__))+"/../.."
import pyutilib.th as unittest
import pyutilib.misc
class CrossDebug(unittest.TestCase):
def setUp(self):
self.tmp = [(10,22,31), (10,22,32), (10,22,33),
(10,23,31), (10,23,32), (10,23,33),
(11,22,31), (11,22,32), (11,22,33),
(11,23,31), (11,23,32), (11,23,33)]
self.tmp.sort()
self.ttmp = [(10,22,31), (10,23,32), (11,22,31), (11,23,32)]
self.ttmp.sort()
def test_cross1(self):
""" Apply the cross() method """
ans = pyutilib.misc.cross( ((10,11), (22,23), (31,32,33)) )
ans.sort()
self.assertEqual(ans, self.tmp)
def test_cross2(self):
""" Apply the cross_iter() method """
ans=[]
for item in pyutilib.misc.cross_iter( (10,11), (22,23), (31,32,33) ):
ans.append(item)
ans.sort()
self.assertEqual(ans, self.tmp)
def test_cross3(self):
""" Apply the flattened_cross_iter() method """
ans=[]
for item in pyutilib.misc.flattened_cross_iter( (10,11), ((22,31), (23,32)) ):
ans.append(item)
ans.sort()
self.assertEqual(ans, self.ttmp)
if __name__ == "__main__":
unittest.main()
|