Exemplo n.º 1
0
    def test_pad(self):
        old = Index([1, 5, 10])
        new = Index(lrange(12))

        filler = algos.pad_int64(old, new)

        expect_filler = [-1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2]
        self.assert_numpy_array_equal(filler, expect_filler)

        # corner case
        old = Index([5, 10])
        new = Index(lrange(5))
        filler = algos.pad_int64(old, new)
        expect_filler = [-1, -1, -1, -1, -1]
        self.assert_numpy_array_equal(filler, expect_filler)
Exemplo n.º 2
0
    def test_pad(self):
        old = Index([1, 5, 10])
        new = Index(range(12))

        filler = algos.pad_int64(old, new)

        expect_filler = [-1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2]
        self.assert_(np.array_equal(filler, expect_filler))

        # corner case
        old = Index([5, 10])
        new = Index(range(5))
        filler = algos.pad_int64(old, new)
        expect_filler = [-1, -1, -1, -1, -1]
        self.assert_(np.array_equal(filler, expect_filler))
Exemplo n.º 3
0
    def test_pad(self):
        old = Index([1, 5, 10])
        new = Index(lrange(12))

        filler = algos.pad_int64(old.values, new.values)

        expect_filler = [-1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2]
        self.assert_numpy_array_equal(filler, expect_filler)

        # corner case
        old = Index([5, 10])
        new = Index(lrange(5))
        filler = algos.pad_int64(old.values, new.values)
        expect_filler = [-1, -1, -1, -1, -1]
        self.assert_numpy_array_equal(filler, expect_filler)
Exemplo n.º 4
0
    def test_pad(self):
        old = Index([1, 5, 10])
        new = Index(lrange(12))

        filler = _algos.pad_int64(old.values, new.values)

        expect_filler = np.array([-1, 0, 0, 0, 0, 1,
                                  1, 1, 1, 1, 2, 2], dtype=np.int64)
        self.assert_numpy_array_equal(filler, expect_filler)

        # corner case
        old = Index([5, 10])
        new = Index(lrange(5))
        filler = _algos.pad_int64(old.values, new.values)
        expect_filler = np.array([-1, -1, -1, -1, -1], dtype=np.int64)
        self.assert_numpy_array_equal(filler, expect_filler)