def test_zero_is_invalid(self): with self.assertRaises(ValueError): g.validate_dimensions(0)
def test_negative_is_invalid(self): with self.assertRaises(ValueError): g.validate_dimensions(-1)
def test_value_error_on_conversion_to_integer_raises_value_error(self): with self.assertRaises(ValueError): g.validate_dimensions('a')
def test_valid_number_as_string(self): self.assertEqual(g.validate_dimensions('4'), 4)
def test_valid_number(self): self.assertEqual(g.validate_dimensions(3), 3)
def test_explicit_none_returns_default(self): self.assertEqual(g.validate_dimensions(None), g.default_num_dimensions)
def test_unpassed_returns_default(self): self.assertEqual(g.validate_dimensions(), g.default_num_dimensions)