summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_struct.py
Commit message (Collapse)AuthorAgeFilesLines
* silence the test when it is skipped on some platforms. should fix aGregory P. Smith2008-06-141-4/+2
| | | | buildbot.
* Merge in release25-maint r60793:Gregory P. Smith2008-06-111-0/+8
| | | | | | Added checks for integer overflows, contributed by Google. Some are only available if asserts are left in the code, in cases where they can't be triggered from Python code.
* convert test_struct to a unittest thanks to Giampaolo RodolaBenjamin Peterson2008-06-111-624/+524
| | | | | I had to disable one test because it was functioning incorrectly, see #1530559 I also removed the debugging prints
* Issue 705836: Fix struct.pack(">f", 1e40) to behave consistentlyMark Dickinson2008-03-141-1/+1
| | | | | | | | | | across platforms: it should now raise OverflowError on all platforms. (Previously it raised OverflowError only on non IEEE 754 platforms.) Also fix the (already existing) test for this behaviour so that it actually raises TestFailed instead of just referencing it.
* Issue 1872: Changed the struct module typecode from 't' to '?', forThomas Heller2008-03-051-14/+14
| | | | compatibility with PEP3118.
* Remove test.test_support.guard_warnings_filter.Brett Cannon2007-08-141-1/+1
| | | | | | | | test.test_support.catch_warning is more full-featured and provides the same functionality. Since guard_warnings_filter was added in 2.6 there is no backwards-compatibility issues.
* Bug #1563759: struct.unpack doens't support buffer protocol objectsRaymond Hettinger2007-04-051-0/+8
|
* Whitespace normalization.Tim Peters2007-01-301-49/+49
|
* Patch #1610575: Add support for _Bool to struct.Martin v. Löwis2007-01-211-7/+61
|
* Add test.test_support.guard_warnings_filter . This function returns a contextBrett Cannon2006-12-131-15/+10
| | | | | manager that protects warnings.filter from being modified once the context is exited.
* Fix #1530559, struct.pack raises TypeError where it used to convert.Bob Ippolito2006-08-041-26/+69
| | | | | Passing float arguments to struct.pack when integers are expected now triggers a DeprecationWarning.
* Access _struct attributes directly instead of mucking with getattr.Tim Peters2006-06-051-20/+18
| | | | | | | | | | string_reverse(): Simplify. assertRaises(): Raise TestFailed on failure. test_unpack_from(), test_pack_into(), test_pack_into_fn(): never use `assert` to test for an expected result (it doesn't test anything when Python is run with -O).
* Fixes in struct and socket from merge reviews.Martin Blais2006-06-041-13/+13
| | | | | | | | | | | | | - Following Guido's comments, renamed * pack_to -> pack_into * recv_buf -> recv_into * recvfrom_buf -> recvfrom_into - Made fixes to _struct.c according to Neal Norwitz comments on the checkins list. - Converted some ints into the appropriate -- I hope -- ssize_t and size_t.
* Whitespace normalization.Tim Peters2006-06-041-2/+1
|
* Fixed struct test to not use unittest.Martin Blais2006-06-021-78/+84
|
* On 64-bit platforms running test_struct after test_tarfile would failNeal Norwitz2006-05-311-0/+6
| | | | since the deprecation warning wouldn't be raised.
* Change wrapping terminology to overflow maskingBob Ippolito2006-05-301-3/+3
|
* deprecated_err(): Stop bizarre warning messages when the testsTim Peters2006-05-301-2/+6
| | | | | | | | | | | are run in the order: test_genexps (or any other doctest-based test) test_struct test_doctest The `warnings` module needs an advertised way to save/restore its internal filter list.
* struct: modulo math plus warning on all endian-explicit formats for ↵Bob Ippolito2006-05-291-11/+36
| | | | compatibility with older struct usage (ugly)
* Fix up struct docstrings, add struct.pack_to function for symmetryBob Ippolito2006-05-271-0/+22
|
* enable all of the struct tests, use ssize_t, fix some whitespaceBob Ippolito2006-05-261-1/+1
|
* fix #1229380 No struct.pack exception for some out of range integersBob Ippolito2006-05-261-3/+5
|
* Whitespace normalization.Tim Peters2006-05-261-2/+1
|
* Support for buffer protocol for socket and struct.Martin Blais2006-05-261-25/+60
| | | | | | | | | | * Added socket.recv_buf() and socket.recvfrom_buf() methods, that use the buffer protocol (send and sendto already did). * Added struct.pack_to(), that is the corresponding buffer compatible method to unpack_from(). * Fixed minor typos in arraymodule.
* refactor unpack, add unpack_fromBob Ippolito2006-05-241-0/+41
|
* Patch #1011240: SystemError generated by struct.pack('P', 'foo').Armin Rigo2004-09-271-0/+1
|
* Replace backticks with repr() or "%r"Walter Dörwald2004-02-121-9/+9
| | | | From SF patch #852334.
* SF bug 705836: struct.pack of floats in non-native endian orderTim Peters2003-03-201-0/+46
| | | | | | | | | | | | | | pack_float, pack_double, save_float: All the routines for creating IEEE-format packed representations of floats and doubles simply ignored that rounding can (in rare cases) propagate out of a long string of 1 bits. At worst, the end-off carry can (by mistake) interfere with the exponent value, and then unpacking yields a result wrong by a factor of 2. In less severe cases, it can end up losing more low-order bits than intended, or fail to catch overflow *caused* by rounding. Bugfix candidate, but I already backported this to 2.2. In 2.3, this code remains in severe need of refactoring.
* Get rid of many apply() calls.Guido van Rossum2003-02-271-5/+2
|
* 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. :)
* The 'p' (Pascal string) pack code acts unreasonably when the string sizeTim Peters2001-09-151-0/+25
| | | | | and count exceed 255. Changed to preserve as much of the string as possible (instead of count%256 characters).
* Added "i" and "l" to the list of std-mode struct codes that don't range-Tim Peters2001-06-181-1/+4
| | | | | check correctly on pack(). While these were checking OK on my 32-bit box, Mark Favas reported failures on a 64-bit box (alas, easy to believe).
* Generalize the new qQ std-mode tests to all int codes (bBhHiIlLqQ).Tim Peters2001-06-131-158/+202
| | | | | | | | Unfortunately, the std-mode bBhHIL codes don't do any range-checking; if and when some of those get fixed, remove their letters from the IntTester.BUGGY_RANGE_CHECK string. In the meantime, a msg saying that range-tests are getting skipped is printed to stdout whenever one is skipped.
* The new {b,l}p_{u,}longlong() didn't check get_pylong()'s return for NULL.Tim Peters2001-06-131-0/+6
| | | | Repaired that, and added appropriate tests for it to test_struct.py.
* Added q/Q standard (x-platform 8-byte ints) mode in struct module.Tim Peters2001-06-121-6/+165
| | | | | | | | | | | | | | This completes the q/Q project. longobject.c _PyLong_AsByteArray: The original code had a gross bug: the most-significant Python digit doesn't necessarily have SHIFT significant bits, and you really need to count how many copies of the sign bit it has else spurious overflow errors result. test_struct.py: This now does exhaustive std q/Q testing at, and on both sides of, all relevant power-of-2 boundaries, both positive and negative. NEWS: Added brief dict news while I was at it.
* Renamed some stuff to tell the truth about what it does.Tim Peters2001-06-101-4/+4
|
* Initial support for 'q' and 'Q' struct format codes: for now, only inTim Peters2001-06-101-10/+47
| | | | | | | | | | | | | | | | | | native mode, and only when config #defines HAVE_LONG_LONG. Standard mode will eventually treat them as 8-byte ints across all platforms, but that likely requires a new set of routines in longobject.c first (while sizeof(long) >= 4 is guaranteed by C, there's nothing in C we can rely on x-platform to hold 8 bytes of int, so we'll have to roll our own; I'm thinking of a simple pair of conversion functions, Python long to/from sized vector of unsigned bytes; that may be useful for GMP conversions too; std q/Q would call them with size fixed at 8). test_struct.py: In addition to adding some native-mode 'q' and 'Q' tests, got rid of unused code, and repaired a non-portable assumption about native sizeof(short) (it isn't 2 on some Cray boxes). libstruct.tex: In addition to adding a bit of 'q'/'Q' docs (more needed later), removed an erroneous footnote about 'I' behavior.
* Update the code to better reflect recommended style:Fred Drake2000-12-121-4/+4
| | | | | Use != instead of <> since <> is documented as "obsolescent". Use "is" and "is not" when comparing with None or type objects.
* Make reindent.py happy (convert everything to 4-space indents!).Fred Drake2000-10-231-1/+1
|
* Mass check-in after untabifying all files that need it.Guido van Rossum1998-03-261-31/+31
|
* Change the ``calcsize*3'' test to be portable to 64-bit machines.Guido van Rossum1997-01-031-3/+7
|
* Added f/d tests for specific byte orders.Guido van Rossum1997-01-031-9/+19
|
* Exercise the new feature set somewhat.Guido van Rossum1996-12-311-10/+73
| | | | Use TestFailed exception and verbose flag from test_support module.
* A test of the struct moduleBarry Warsaw1996-12-121-0/+44