diff Python/bltinmodule.c @ 87489:95dc3054959b

Issue #3158: doctest can now find doctests in functions and methods written in C. As a part of this, a few doctests have been added to the builtins module (on hex(), oct(), and bin()), a doctest has been fixed (hopefully on all platforms) on float, and test_builtins now runs doctests in builtins.
author Zachary Ware <zachary.ware@gmail.com>
date Sun, 24 Nov 2013 01:19:09 -0600
parents 01c4a0af73cf
children
line wrap: on
line diff
--- a/Python/bltinmodule.c	Sun Nov 24 14:58:31 2013 +1000
+++ b/Python/bltinmodule.c	Sun Nov 24 01:19:09 2013 -0600
@@ -350,7 +350,11 @@
 PyDoc_STRVAR(bin_doc,
 "bin(number) -> string\n\
 \n\
-Return the binary representation of an integer.");
+Return the binary representation of an integer.\n\
+\n\
+   >>> bin(2796202)\n\
+   '0b1010101010101010101010'\n\
+");
 
 
 static PyObject *
@@ -1276,7 +1280,11 @@
 PyDoc_STRVAR(hex_doc,
 "hex(number) -> string\n\
 \n\
-Return the hexadecimal representation of an integer.");
+Return the hexadecimal representation of an integer.\n\
+\n\
+   >>> hex(3735928559)\n\
+   '0xdeadbeef'\n\
+");
 
 
 static PyObject *
@@ -1476,7 +1484,11 @@
 PyDoc_STRVAR(oct_doc,
 "oct(number) -> string\n\
 \n\
-Return the octal representation of an integer.");
+Return the octal representation of an integer.\n\
+\n\
+   >>> oct(342391)\n\
+   '0o1234567'\n\
+");
 
 
 static PyObject *