def test_format_disallow_invalid_type(self):
     with self.assertRaisesRegex(ValueError, "Unknown format code 'T'"):
         types.NumberFormatter("{:T}")
 def test_format_disallow_field_converter(self):
     with self.assertRaisesRegex(ValueError, "Field converters are not allowed"):
         types.NumberFormatter("{!r:f}")
 def test_format_disallow_non_format(self):
     with self.assertRaisesRegex(ValueError, 'Format must look like "{:...}"'):
         types.NumberFormatter("%d")
 def test_format_disallow_field_name(self):
     with self.assertRaisesRegex(
         ValueError, "Field names or numbers are not allowed"
     ):
         types.NumberFormatter("{value:f}")
 def test_format_too_many_arguments(self):
     with self.assertRaisesRegex(ValueError, "Can only format one number"):
         types.NumberFormatter("{:d}{:f}")