Exemplo n.º 1
0
    def test__pad(self):
        data = [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]
        pad_len = 2
        pad = lambda x, c: x[:len(x) // 2] + [0] * c + x[len(x) // 2:]
        expected = pad(list(data),
                       2**peakdetect._n(len(data) * pad_len) - len(data))
        received = peakdetect._pad(data, pad_len)

        self.assertListEqual(received, expected)
Exemplo n.º 2
0
 def test__n(self):
     self.assertEqual(2**peakdetect._n(1000), 1024)