Beispiel #1
0
 def testSortedStride(self):
     for inp in self.inputs:
         weights = [(20 - i) for i in inp[0]]
         pfunc = partition.SortedStride()
         actual = pfunc(list(zip(inp[0], weights)), inp[1], inp[2])
         expected = list(inp[0][:])
         expected.reverse()
         expected = expected[inp[1]::inp[2]]
         self.assertEqual(actual, expected)
Beispiel #2
0
 def testSortedStride(self):
     for inp in self.inputs:
         weights = array([(20 - i) for i in inp[0]])
         pfunc = partition.SortedStride()
         data = dstack((inp[0], weights))[0]
         actual = pfunc(data, inp[1], inp[2])
         expected = inp[0][::-1]
         expected = expected[inp[1]::inp[2]]
         testing.assert_array_equal(actual, expected)
Beispiel #3
0
 def testSortedStride(self):
     for inp in self.inputs:
         weights = numpy.array([(20 - i) for i in inp[0]])
         pfunc = partition.SortedStride()
         data = numpy.dstack((inp[0], weights))[0]
         actual = pfunc(data, inp[1], inp[2])
         expected = inp[0][::-1]
         expected = expected[inp[1]::inp[2]]
         msg = test_info_msg('SortedStride', data, inp[1], inp[2], actual,
                             expected)
         print msg
         numpy.testing.assert_array_equal(actual, expected, msg)
Beispiel #4
0
 def testSortedStride(self):
     for inp in self.inputs:
         weights = [(20 - i) for i in inp[0]]
         pfunc = partition.SortedStride()
         actual = pfunc(zip(inp[0], weights), inp[1], inp[2])
         expected = inp[0][:]
         expected.reverse()
         expected = expected[inp[1]::inp[2]]
         msg = test_info_msg('SortedStride', zip(inp[0], weights), inp[1],
                             inp[2], actual, expected)
         print msg
         self.assertEqual(actual, expected, msg)