Esempio n. 1
0
 def test_ndimensionsal(self):
     """Test n-dimensional slices."""
     self.assertEqual(
         parse_hyperslab('[0:2:9][0][0:99]'),
         (slice(0, 10, 2), slice(0, 1, 1), slice(0, 100, 1)))
Esempio n. 2
0
 def test_start_step_stop(self):
     """Test start, step and stop."""
     self.assertEqual(parse_hyperslab('[0:2:9]'), (slice(0, 10, 2),))
Esempio n. 3
0
 def test_invalid(self):
     """Test invalid hyperslab."""
     with self.assertRaises(ConstraintExpressionError):
         parse_hyperslab('[0:2:9:1]')
Esempio n. 4
0
 def test_point(self):
     """Test a single value selection."""
     self.assertEqual(parse_hyperslab('[0]'), (slice(0, 1, 1),))
Esempio n. 5
0
 def test_start_stop(self):
     """Test start and stop, default step."""
     self.assertEqual(parse_hyperslab('[0:1]'), (slice(0, 2, 1),))
Esempio n. 6
0
 def test_ndimensionsal(self):
     """Test n-dimensional slices."""
     self.assertEqual(parse_hyperslab("[0:2:9][0][0:99]"), (slice(0, 10, 2), slice(0, 1, 1), slice(0, 100, 1)))
Esempio n. 7
0
 def test_invalid(self):
     """Test invalid hyperslab."""
     with self.assertRaises(ConstraintExpressionError):
         parse_hyperslab("[0:2:9:1]")
Esempio n. 8
0
 def test_start_step_stop(self):
     """Test start, step and stop."""
     self.assertEqual(parse_hyperslab("[0:2:9]"), (slice(0, 10, 2),))
Esempio n. 9
0
 def test_start_stop(self):
     """Test start and stop, default step."""
     self.assertEqual(parse_hyperslab("[0:1]"), (slice(0, 2, 1),))
Esempio n. 10
0
 def test_point(self):
     """Test a single value selection."""
     self.assertEqual(parse_hyperslab("[0]"), (slice(0, 1, 1),))