Exemplo n.º 1
0
    def test_find_pposite_axis_valid_cases(self):
        testcases = (
            dict(input_kwargs={'axes': [0, 1], 'ndim': 4},
                 expected_output=[2, 3]),
            dict(input_kwargs={'axes': [], 'ndim': 4},
                 expected_output=[0, 1, 2, 3]),
            dict(input_kwargs={'axes': [0, 1, 2], 'ndim': 3},
                 expected_output=[]),
        )

        for testcase in testcases:
            actual_output = find_opposite_axes(**testcase['input_kwargs'])
            self.assertEqual(actual_output, testcase['expected_output'],
                             msg="Kwargs: ".format(testcase['input_kwargs']))
Exemplo n.º 2
0
    def test_find_pposite_axis_valid_cases(self):
        testcases = (
            dict(input_kwargs={
                'axes': [0, 1],
                'ndim': 4
            },
                 expected_output=[2, 3]),
            dict(input_kwargs={
                'axes': [],
                'ndim': 4
            },
                 expected_output=[0, 1, 2, 3]),
            dict(input_kwargs={
                'axes': [0, 1, 2],
                'ndim': 3
            },
                 expected_output=[]),
        )

        for testcase in testcases:
            actual_output = find_opposite_axes(**testcase['input_kwargs'])
            self.assertEqual(actual_output,
                             testcase['expected_output'],
                             msg="Kwargs: ".format(testcase['input_kwargs']))
Exemplo n.º 3
0
    def test_find_pposite_axis_invalid_cases(self):
        with self.assertRaises(ValueError):
            find_opposite_axes(axes=[5], ndim=1)

        with self.assertRaises(ValueError):
            find_opposite_axes(axes=[0, 1], ndim=1)
Exemplo n.º 4
0
    def test_find_pposite_axis_invalid_cases(self):
        with self.assertRaises(ValueError):
            find_opposite_axes(axes=[5], ndim=1)

        with self.assertRaises(ValueError):
            find_opposite_axes(axes=[0, 1], ndim=1)