MCPcopy Index your code
hub / github.com/python/cpython / test_basic

Method test_basic

Lib/test/test_capi/test_unicode.py:1761–1782  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1759 return _testcapi.PyUnicodeWriter(size)
1760
1761 def test_basic(self):
1762 writer = self.create_writer(100)
1763
1764 # test PyUnicodeWriter_WriteUTF8()
1765 writer.write_utf8(b'var', -1)
1766
1767 # test PyUnicodeWriter_WriteChar()
1768 writer.write_char(ord('='))
1769
1770 # test PyUnicodeWriter_WriteSubstring()
1771 writer.write_substring("[long]", 1, 5)
1772 # CRASHES writer.write_substring(NULL, 0, 0)
1773
1774 # test PyUnicodeWriter_WriteStr()
1775 writer.write_str(" value ")
1776 # CRASHES writer.write_str(NULL)
1777
1778 # test PyUnicodeWriter_WriteRepr()
1779 writer.write_repr("repr")
1780
1781 self.assertEqual(writer.finish(),
1782 "var=long value 'repr'")
1783
1784 def test_repr_null(self):
1785 writer = self.create_writer(0)

Callers

nothing calls this directly

Calls 5

create_writerMethod · 0.95
write_charMethod · 0.80
write_reprMethod · 0.45
assertEqualMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected