def test_normalize_axis_tuple(): assert normalize_axis_tuple(-1, 3) == (2, ) assert normalize_axis_tuple([0, -2], 3) == (0, 1) assert sorted(normalize_axis_tuple({0, -2}, 3)) == [0, 1] with pytest.raises(ValueError) as cm: normalize_axis_tuple((1, -2), 3, argname='axes') assert 'axes' in str(cm.value) with pytest.raises(ValueError): normalize_axis_tuple((1, -2), 3)
def testNormalizeAxisTuple(self): self.assertEqual(normalize_axis_tuple(-1, 3), (2,)) self.assertEqual(normalize_axis_tuple([0, -2], 3), (0, 1)) self.assertEqual(sorted(normalize_axis_tuple({0, -2}, 3)), [0, 1]) with self.assertRaises(ValueError) as cm: normalize_axis_tuple((1, -2), 3, argname='axes') self.assertIn('axes', str(cm.exception)) with self.assertRaises(ValueError): normalize_axis_tuple((1, -2), 3)