summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_format.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix segfault when doing string formatting on subclasses of long ifNeal Norwitz2006-08-131-0/+8
| | | | | | __oct__, __hex__ don't return a string. Klocwork 308
* Fix a bug discovered by Kalle Svensson: comparing sys.maxint toGuido van Rossum2003-11-291-1/+1
| | | | 2**32-1 makes no sense. Use 2**31-1 instead.
* - Removed FutureWarnings related to hex/oct literals and conversionsGuido van Rossum2003-11-291-5/+2
| | | | | | | | | | and left shifts. (Thanks to Kalle Svensson for SF patch 849227.) This addresses most of the remaining semantic changes promised by PEP 237, except for repr() of a long, which still shows the trailing 'L'. The PEP appears to promise warnings for operations that changed semantics compared to Python 2.3, but this is not implemented; we've suffered through enough warnings related to hex/oct literals and I think it's best to be silent now.
* Whitespace normalization.Tim Peters2002-11-241-4/+4
|
* Fix SF # 635969, No error "not all arguments converted"Neal Norwitz2002-11-121-0/+8
| | | | | | | | | When mwh added extended slicing, strings and unicode became mappings. Thus, dict was set which prevented an error when doing: newstr = 'format without a percent' % string_value This fix raises an exception again when there are no formats and % with a string value.
* A test for the recent overflow-in-format-crash bug.Michael W. Hudson2002-10-111-2/+14
| | | | | Only runs when sys.maxint == 2**32 - 1; different things go wrong on a 64-bit box.
* Whitespace normalization.Tim Peters2002-08-081-1/+0
|
* Fix the problem of not raising a TypeError exception when doing:Neal Norwitz2002-07-281-1/+7
| | | | | | | | '%g' % '1' '%d' % '1' Add a test for these conditions Fix the test so that if not exception is raise, this is a failure
* Get rid of relative imports in all unittests. Now anything thatBarry Warsaw2002-07-231-1/+1
| | | | | | | | | | | imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :)
* Use raw-unicode-escape for the tests that require it.Martin v. Löwis2001-08-171-1/+1
|
* Patch #445762: Support --disable-unicodeMartin v. Löwis2001-08-171-4/+6
| | | | | | | | - Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled - check for Py_USING_UNICODE in all places that use Unicode functions - disables unicode literals, and the builtin functions - add the types.StringTypes list - remove Unicode literals from most tests.
* Bug 415514 reported that e.g.Tim Peters2001-04-121-4/+4
| | | | | | | | | | | | "%#x" % 0 blew up, at heart because C sprintf supplies a base marker if and only if the value is not 0. I then fixed that, by tolerating C's inconsistency when it does %#x, and taking away that *Python* produced 0x0 when formatting 0L (the "long" flavor of 0) under %#x itself. But after talking with Guido, we agreed it would be better to supply 0x for the short int case too, despite that it's inconsistent with C, because C is inconsistent with itself and with Python's hex(0) (plus, while "%#x" % 0 didn't work before, "%#x" % 0L *did*, and returned "0x0"). Similarly for %#X conversion.
* Fix for SF bug #415514: "%#x" % 0 caused assertion failure/abort.Tim Peters2001-04-121-0/+16
| | | | | | | | | | | | | http://sourceforge.net/tracker/index.php?func=detail&aid=415514&group_id=5470&atid=105470 For short ints, Python defers to the platform C library to figure out what %#x should do. The code asserted that the platform C returned a string beginning with "0x". However, that's not true when-- and only when --the *value* being formatted is 0. Changed the code to live with C's inconsistency here. In the meantime, the problem does not arise if you format a long 0 (0L) instead. However, that's because the code *we* wrote to do %#x conversions on longs produces a leading "0x" regardless of value. That's probably wrong too: we should drop leading "0x", for consistency with C, when (& only when) formatting 0L. So I changed the long formatting code to do that too.
* String method conversion.Eric S. Raymond2001-02-091-1/+1
| | | | (This one was trivial -- no actual string. references in it!)
* Whitespace normalization. Leaving tokenize_tests.py alone for now.Tim Peters2001-01-181-1/+0
|
* a bold attempt to fix things broken by MAL's verify patch: importFredrik Lundh2001-01-171-2/+2
| | | | 'verify' iff it's used by a test module...
* This patch removes all uses of "assert" in the regression test suiteMarc-André Lemburg2001-01-171-1/+1
| | | | | | | and replaces them with a new API verify(). As a result the regression suite will also perform its tests in optimization mode. Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
* Change expected message for ValueError, fixing bug #126400Andrew M. Kuchling2000-12-201-1/+1
|
* Add test case for error message raised by bad % format characterAndrew M. Kuchling2000-12-151-0/+25
| | | | (Oh, look, it adds another little utility function for testing)
* Fox for SF bug #123859: %[duxXo] long formats inconsistent.Tim Peters2000-11-301-5/+16
|
* Derived from Martin's SF patch 110609: support unbounded ints in ↵Tim Peters2000-09-211-23/+136
| | | | | | | | | | | | | | | | %d,i,u,x,X,o formats. Note a curious extension to the std C rules: x, X and o formatting can never produce a sign character in C, so the '+' and ' ' flags are meaningless for them. But unbounded ints *can* produce a sign character under these conversions (no fixed- width bitstring is wide enough to hold all negative values in 2's-comp form). So these flags become meaningful in Python when formatting a Python long which is too big to fit in a C long. This required shuffling around existing code, which hacked x and X conversions to death when both the '#' and '0' flags were specified: the hacks weren't strong enough to deal with the simultaneous possibility of the ' ' or '+' flags too, since signs were always meaningless before for x and X conversions. Isomorphic shuffling was required in unicodeobject.c. Also added dozens of non-trivial new unbounded-int test cases to test_format.py.
* Marc-Andre Lemburg <mal@lemburg.com>:Marc-André Lemburg2000-06-301-0/+52
New test for huge formatting strings (these could cause core dumps in previous versions). By Trent Mick.