MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_specifier_z_error

Method test_specifier_z_error

Lib/test/test_format.py:623–640  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

621
622 @unittest.expectedFailure # TODO: RUSTPYTHON
623 def test_specifier_z_error(self):
624 error_msg = re.compile("Invalid format specifier '.*z.*'")
625 with self.assertRaisesRegex(ValueError, error_msg):
626 f"{0:z+f}" # wrong position
627 with self.assertRaisesRegex(ValueError, error_msg):
628 f"{0:fz}" # wrong position
629
630 error_msg = re.escape("Negative zero coercion (z) not allowed")
631 with self.assertRaisesRegex(ValueError, error_msg):
632 f"{0:zd}" # can't apply to int presentation type
633 with self.assertRaisesRegex(ValueError, error_msg):
634 f"{'x':zs}" # can't apply to string
635
636 error_msg = re.escape("unsupported format character 'z'")
637 with self.assertRaisesRegex(ValueError, error_msg):
638 "%z.1f" % 0 # not allowed in old style string interpolation
639 with self.assertRaisesRegex(ValueError, error_msg):
640 b"%z.1f" % 0
641
642
643if __name__ == "__main__":

Callers

nothing calls this directly

Calls 3

assertRaisesRegexMethod · 0.80
escapeMethod · 0.80
compileMethod · 0.45

Tested by

no test coverage detected