コード例 #1
0
    def pad_test(self):
        config.block_size = 2

        samples = numpy.vstack([numpy.arange(0, 10), numpy.arange(0, 10) * 2]).transpose()
        iter_gen = stream_functions.iter(samples, start=4.0/config.frame_rate, end=5.0/config.frame_rate, pad=True)

        numpy.testing.assert_array_equal(next(iter_gen), [[4, 8], [0, 0]])
        self.assertRaises(StopIteration, next, iter_gen)
コード例 #2
0
    def start_test(self):
        config.block_size = 2

        samples = numpy.vstack([numpy.arange(0, 10), numpy.arange(0, 10) * 2]).transpose()
        iter_gen = stream_functions.iter(samples, start=4.0/config.frame_rate)

        numpy.testing.assert_array_equal(next(iter_gen), [[4, 8], [5, 10]])
        numpy.testing.assert_array_equal(next(iter_gen), [[6, 12], [7, 14]])
        numpy.testing.assert_array_equal(next(iter_gen), [[8, 16], [9, 18]])
        self.assertRaises(StopIteration, next, iter_gen)