Пример #1
0
 def test_zero_is_invalid(self):
     with self.assertRaises(ValueError):
         g.validate_dimensions(0)
Пример #2
0
 def test_negative_is_invalid(self):
     with self.assertRaises(ValueError):
         g.validate_dimensions(-1)
Пример #3
0
 def test_value_error_on_conversion_to_integer_raises_value_error(self):
     with self.assertRaises(ValueError):
         g.validate_dimensions('a')
Пример #4
0
 def test_valid_number_as_string(self):
     self.assertEqual(g.validate_dimensions('4'), 4)
Пример #5
0
 def test_valid_number(self):
     self.assertEqual(g.validate_dimensions(3), 3)
Пример #6
0
 def test_explicit_none_returns_default(self):
     self.assertEqual(g.validate_dimensions(None), g.default_num_dimensions)
Пример #7
0
 def test_unpassed_returns_default(self):
     self.assertEqual(g.validate_dimensions(), g.default_num_dimensions)