def test_1ary_defaults_3to6(self):
     a = np.array([[1., 2., 3.], [4., 5., 6.], [7., 8., 9.]])
     exp = np.array([[0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0.],
                     [0., 0., 1., 2., 3., 0.], [0., 0., 4., 5., 6., 0.],
                     [0., 0., 7., 8., 9., 0.], [0., 0., 0., 0., 0., 0.]])
     got = square_padding(ary=a, n_elements=6, value=0)
     np.testing.assert_allclose(exp, got)
    def test_2ary_defaults_3to7(self):
        a = np.array([[[1., 2., 3.],
                       [4., 5., 6.],
                       [7., 8., 9.]],
                      [[10., 11., 12.],
                       [13., 5., 6.],
                       [7., 8., 9.]]])

        exp = np.array([[[0., 0., 0., 0., 0., 0., 0.],
                         [0., 0., 0., 0., 0., 0., 0.],
                         [0., 0., 1., 2., 3., 0., 0.],
                         [0., 0., 4., 5., 6., 0., 0.],
                         [0., 0., 7., 8., 9., 0., 0.],
                         [0., 0., 0., 0., 0., 0., 0.],
                         [0., 0., 0., 0., 0., 0., 0.]],
                        [[0., 0., 0., 0., 0., 0., 0.],
                         [0., 0., 0., 0., 0., 0., 0.],
                         [0., 0., 10., 11., 12., 0., 0.],
                         [0., 0., 13., 5., 6., 0., 0.],
                         [0., 0., 7., 8., 9., 0., 0.],
                         [0., 0., 0., 0., 0., 0., 0.],
                         [0., 0., 0., 0., 0., 0., 0.]]])

        got = square_padding(ary=a, n_elements=7, axes=(1, 2), value=0)
        np.testing.assert_allclose(exp, got)
 def test_1ary_defaults_3to6(self):
     a = np.array([[1., 2., 3.],
                   [4., 5., 6.],
                   [7., 8., 9.]])
     exp = np.array([[0., 0., 0., 0., 0., 0.],
                     [0., 0., 0., 0., 0., 0.],
                     [0., 0., 1., 2., 3., 0.],
                     [0., 0., 4., 5., 6., 0.],
                     [0., 0., 7., 8., 9., 0.],
                     [0., 0., 0., 0., 0., 0.]])
     got = square_padding(ary=a, n_elements=6, value=0)
     np.testing.assert_allclose(exp, got)
    def test_2ary_defaults_3to7(self):
        a = np.array([[[1., 2., 3.], [4., 5., 6.], [7., 8., 9.]],
                      [[10., 11., 12.], [13., 5., 6.], [7., 8., 9.]]])

        exp = np.array([[[0., 0., 0., 0., 0., 0., 0.],
                         [0., 0., 0., 0., 0., 0., 0.],
                         [0., 0., 1., 2., 3., 0., 0.],
                         [0., 0., 4., 5., 6., 0., 0.],
                         [0., 0., 7., 8., 9., 0., 0.],
                         [0., 0., 0., 0., 0., 0., 0.],
                         [0., 0., 0., 0., 0., 0., 0.]],
                        [[0., 0., 0., 0., 0., 0., 0.],
                         [0., 0., 0., 0., 0., 0., 0.],
                         [0., 0., 10., 11., 12., 0., 0.],
                         [0., 0., 13., 5., 6., 0., 0.],
                         [0., 0., 7., 8., 9., 0., 0.],
                         [0., 0., 0., 0., 0., 0., 0.],
                         [0., 0., 0., 0., 0., 0., 0.]]])

        got = square_padding(ary=a, n_elements=7, axes=(1, 2), value=0)
        np.testing.assert_allclose(exp, got)