Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-bitarray for openSUSE:Factory
checked in at 2023-10-05 20:04:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-bitarray (Old)
and /work/SRC/openSUSE:Factory/.python-bitarray.new.28202 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-bitarray"
Thu Oct 5 20:04:57 2023 rev:21 rq:1115784 version:2.8.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-bitarray/python-bitarray.changes
2023-08-09 17:26:14.665750519 +0200
+++
/work/SRC/openSUSE:Factory/.python-bitarray.new.28202/python-bitarray.changes
2023-10-05 20:06:07.861167934 +0200
@@ -1,0 +2,12 @@
+Thu Oct 5 09:32:42 UTC 2023 - Dirk Müller <[email protected]>
+
+- update to 2.8.2:
+ * improve error messages for masked assignment
+ * simplify test collection
+ * added ``pytest.ini`` to allow running pytest with no
+ additional arguments
+ * ``util.sc_encode()``: avoid writing empty blocks at end of
+ compressed stream, ie. skip encoding when total population
+ count is reached
+
+-------------------------------------------------------------------
Old:
----
bitarray-2.8.1.tar.gz
New:
----
bitarray-2.8.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-bitarray.spec ++++++
--- /var/tmp/diff_new_pack.Uuq2JC/_old 2023-10-05 20:06:08.969207964 +0200
+++ /var/tmp/diff_new_pack.Uuq2JC/_new 2023-10-05 20:06:08.973208108 +0200
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-bitarray
-Version: 2.8.1
+Version: 2.8.2
Release: 0
Summary: Efficient Arrays of Booleans
License: Python-2.0
++++++ bitarray-2.8.1.tar.gz -> bitarray-2.8.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bitarray-2.8.1/.github/workflows/build_wheels.yml
new/bitarray-2.8.2/.github/workflows/build_wheels.yml
--- old/bitarray-2.8.1/.github/workflows/build_wheels.yml 2023-08-07
01:06:01.000000000 +0200
+++ new/bitarray-2.8.2/.github/workflows/build_wheels.yml 2023-10-03
11:35:05.000000000 +0200
@@ -20,7 +20,7 @@
platforms: all
- name: Build wheels
- uses: pypa/[email protected]
+ uses: pypa/[email protected]
# to supply options, put them in 'env', like:
env:
# configure cibuildwheel to build native archs ('auto'), and some
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bitarray-2.8.1/CHANGE_LOG
new/bitarray-2.8.2/CHANGE_LOG
--- old/bitarray-2.8.1/CHANGE_LOG 2023-08-07 01:06:01.000000000 +0200
+++ new/bitarray-2.8.2/CHANGE_LOG 2023-10-03 11:35:05.000000000 +0200
@@ -1,3 +1,14 @@
+2023-10-03 2.8.2:
+-------------------
+ * update cibuildwheel to 2.16.1 in order to provide cp312 wheels on PyPI
+ * improve error messages for masked assignment
+ * simplify test collection
+ * added `pytest.ini` to allow running pytest with no additional arguments,
+ see #208
+ * `util.sc_encode()`: avoid writing empty blocks at end of compressed
+ stream, ie. skip encoding when total population count is reached
+
+
2023-08-06 2.8.1:
-------------------
* use reconstructor function for pickling, see #207
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bitarray-2.8.1/README.rst
new/bitarray-2.8.2/README.rst
--- old/bitarray-2.8.1/README.rst 2023-08-07 01:06:01.000000000 +0200
+++ new/bitarray-2.8.2/README.rst 2023-10-03 11:35:05.000000000 +0200
@@ -63,7 +63,7 @@
$ python -c 'import bitarray; bitarray.test()'
bitarray is installed in: /Users/ilan/bitarray/bitarray
- bitarray version: 2.8.1
+ bitarray version: 2.8.2
sys.version: 3.11.0 (main, Oct 25 2022) [Clang 14.0.4]
sys.prefix: /Users/ilan/Mini3/envs/py311
pointer size: 64 bit
@@ -90,8 +90,8 @@
assert bitarray.test().wasSuccessful()
-Using the module
-----------------
+Usage
+-----
As mentioned above, bitarray objects behave very much like lists, so
there is not too much to learn. The biggest difference from list
@@ -411,7 +411,7 @@
Reference
=========
-bitarray version: 2.8.1 -- `change log
<https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
+bitarray version: 2.8.2 -- `change log
<https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
In the following, ``item`` and ``value`` are usually a single bit -
an integer 0 or 1.
@@ -701,7 +701,7 @@
New in version 1.3.
-``test(verbosity=1, repeat=1)`` -> TextTestResult
+``test(verbosity=1)`` -> TextTestResult
Run self-test, and return unittest.runner.TextTestResult object.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bitarray-2.8.1/bitarray/__init__.py
new/bitarray-2.8.2/bitarray/__init__.py
--- old/bitarray-2.8.1/bitarray/__init__.py 2023-08-07 01:06:01.000000000
+0200
+++ new/bitarray-2.8.2/bitarray/__init__.py 2023-10-03 11:35:05.000000000
+0200
@@ -67,10 +67,10 @@
return (__n + 7) // 8
-def test(verbosity=1, repeat=1):
- """test(verbosity=1, repeat=1) -> TextTestResult
+def test(verbosity=1):
+ """test(verbosity=1) -> TextTestResult
Run self-test, and return unittest.runner.TextTestResult object.
"""
from bitarray import test_bitarray
- return test_bitarray.run(verbosity=verbosity, repeat=repeat)
+ return test_bitarray.run(verbosity=verbosity)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bitarray-2.8.1/bitarray/__init__.pyi
new/bitarray-2.8.2/bitarray/__init__.pyi
--- old/bitarray-2.8.1/bitarray/__init__.pyi 2023-08-07 01:06:01.000000000
+0200
+++ new/bitarray-2.8.2/bitarray/__init__.pyi 2023-10-03 11:35:05.000000000
+0200
@@ -132,7 +132,7 @@
__version__: str
def bits2bytes(n: int) -> int: ...
def get_default_endian() -> str: ...
-def test(verbosity: int = ..., repeat: int = ...) -> TextTestResult: ...
+def test(verbosity: int = ...) -> TextTestResult: ...
def _set_default_endian(endian: str) -> None: ...
def _sysinfo() -> tuple: ...
def _bitarray_reconstructor(cls: type,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bitarray-2.8.1/bitarray/_bitarray.c
new/bitarray-2.8.2/bitarray/_bitarray.c
--- old/bitarray-2.8.1/bitarray/_bitarray.c 2023-08-07 01:06:01.000000000
+0200
+++ new/bitarray-2.8.2/bitarray/_bitarray.c 2023-10-03 11:35:05.000000000
+0200
@@ -749,9 +749,8 @@
if (PyBytes_Check(obj)) { /* bytes 01 */
#if IS_PY3K
- PyErr_SetString(PyExc_TypeError,
- "cannot extend bitarray with 'bytes', "
- "use .pack() or .frombytes() instead");
+ PyErr_SetString(PyExc_TypeError, "cannot extend bitarray with "
+ "'bytes', use .pack() or .frombytes() instead");
return -1;
#else
return extend_bytes01(self, obj);
@@ -1192,7 +1191,7 @@
}
result = Py_BuildValue("O(OOsii)O", reconstructor, Py_TYPE(self), bytes,
- ENDIAN_STR(self->endian), PADBITS(self),
+ ENDIAN_STR(self->endian), (int) PADBITS(self),
self->readonly, dict);
Py_DECREF(dict);
Py_DECREF(bytes);
@@ -2233,9 +2232,7 @@
{
Py_ssize_t n = 0, i;
- if (check_mask_length(self, mask) < 0)
- return -1;
-
+ assert(self->nbits == mask->nbits);
for (i = 0; i < mask->nbits; i++) {
if (getbit(mask, i) == 0) /* set items we want to keep */
setbit(self, n++, getbit(self, i));
@@ -2249,11 +2246,27 @@
static int
assign_mask(bitarrayobject *self, bitarrayobject *mask, PyObject *value)
{
+ if (check_mask_length(self, mask) < 0)
+ return -1;
+
if (value == NULL)
return delmask(self, mask);
- PyErr_SetString(PyExc_NotImplementedError, "masked assignment "
- "not implemented - use bitwise operations");
+ if (bitarray_Check(value)) {
+ PyErr_SetString(PyExc_NotImplementedError,
+ "mask assignment to bitarrays not implemented");
+ return -1;
+ }
+
+ if (PyIndex_Check(value)) {
+ PyErr_SetString(PyExc_NotImplementedError, "mask assignment to "
+ "Booleans not implemented - use bitwise operations");
+ return -1;
+ }
+
+ PyErr_Format(PyExc_TypeError,
+ "bitarray or int expected for mask assignment, not '%s'",
+ Py_TYPE(value)->tp_name);
return -1;
}
@@ -2286,8 +2299,7 @@
n = PySequence_Size(seq);
if (n != other->nbits) {
PyErr_Format(PyExc_ValueError, "attempt to assign sequence of "
- "size %zd to bitarray of size %zd",
- n, other->nbits);
+ "size %zd to bitarray of size %zd", n, other->nbits);
return -1;
}
/* Make a copy of other, in case the buffers overlap. This is obviously
@@ -2347,6 +2359,8 @@
static int
assign_sequence(bitarrayobject *self, PyObject *seq, PyObject *value)
{
+ assert(PySequence_Check(seq));
+
if (value == NULL)
return delsequence(self, seq);
@@ -2356,9 +2370,8 @@
if (PyIndex_Check(value))
return setseq_bool(self, seq, value);
- PyErr_Format(PyExc_TypeError,
- "bitarray or int expected for sequence assignment, not '%s'",
- Py_TYPE(value)->tp_name);
+ PyErr_Format(PyExc_TypeError, "bitarray or int expected for sequence "
+ "assignment, not '%s'", Py_TYPE(value)->tp_name);
return -1;
}
@@ -2661,8 +2674,7 @@
check_value(PyObject *value)
{
if (!bitarray_Check(value)) {
- PyErr_SetString(PyExc_TypeError,
- "bitarray expected for dict value");
+ PyErr_SetString(PyExc_TypeError, "bitarray expected for dict value");
return -1;
}
if (((bitarrayobject *) value)->nbits == 0) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bitarray-2.8.1/bitarray/_util.c
new/bitarray-2.8.2/bitarray/_util.c
--- old/bitarray-2.8.1/bitarray/_util.c 2023-08-07 01:06:01.000000000 +0200
+++ new/bitarray-2.8.2/bitarray/_util.c 2023-10-03 11:35:05.000000000 +0200
@@ -1056,8 +1056,7 @@
BSI(1) = 32 must be divisible by SEGSIZE.
SEGSIZE must also be a multiple of the word size (sizeof(uint64_t) = 8).
The size 32 is rooted in the fact that a bitarray of 32 bytes (256 bits)
- can be indexed with one index byte (BSI(1) = 32). Our entire 'sc' format
- is constructed around this. */
+ can be indexed with one index byte (BSI(1) = 32). */
#define SEGSIZE 32
/* number of segments for given number of bits */
@@ -1323,9 +1322,8 @@
Notes:
- 32 index bytes take up as much space as a raw buffer of 32 bytes.
- Hence, we start by counting up to 32 bits in the first 32 bytes of the
- bitarray buffer in order to decide whether a raw block (type 0) should
- be used.
+ Hence, if the bit count of the first 32 bytes of the bitarray buffer
+ is greater or equal to 32, we choose a raw block (type 0).
- If a raw block is used, we check if the next three 32 byte buffer
blocks are also suitable for raw encoding, see write_raw_block().
@@ -1416,6 +1414,7 @@
bitarrayobject *a;
Py_ssize_t offset = 0; /* block offset into bitarray `a` in bytes */
Py_ssize_t *rts; /* running totals for 256 bit segments */
+ Py_ssize_t t; /* total population count of bitarray `a` */
if (ensure_bitarray(obj) < 0)
return NULL;
@@ -1432,14 +1431,18 @@
str = PyBytes_AS_STRING(out);
len += sc_encode_header(str, a);
- while (offset < Py_SIZE(a)) {
+ t = rts[NSEG(a->nbits)];
+ /* encode blocks as long as we haven't reached the end of the bitarray
+ and haven't reached the total population count yet */
+ while (offset < Py_SIZE(a) && rts[offset / SEGSIZE] != t) {
Py_ssize_t allocated; /* size (in bytes) of output buffer */
/* Make sure we have enough space in output buffer for next block.
The largest block possible is a type 4 block with 255 indices.
- It's size is: 2 header bytes + 4 * 255 index bytes */
+ It's size is: 2 header bytes + 4 * 255 index bytes.
+ Plus, we also may have the stop byte. */
allocated = PyBytes_GET_SIZE(out);
- if (allocated < len + 2 + 4 * 255) { /* increase allocation */
+ if (allocated < len + 2 + 4 * 255 + 1) { /* increase allocation */
if (_PyBytes_Resize(&out, allocated + 32768) < 0)
return NULL;
str = PyBytes_AS_STRING(out);
@@ -1499,6 +1502,7 @@
char *buff = a->ob_item + offset;
Py_ssize_t i;
+ assert(1 <= k && k <= 128);
if (offset + k > Py_SIZE(a)) {
PyErr_Format(PyExc_ValueError, "decode error (raw): %zd + %d > %zd",
offset, k, Py_SIZE(a));
@@ -1561,7 +1565,7 @@
if (0xc2 <= head && head <= 0xc4) { /* type 2 .. 4 - 0xc2 .. 0xc4 */
int k;
- if ((k = next_char(iter)) < 0)
+ if ((k = next_char(iter)) < 0) /* index count byte */
return -1;
return sc_read_sparse(a, offset, iter, head - 0xc0, k);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bitarray-2.8.1/bitarray/bitarray.h
new/bitarray-2.8.2/bitarray/bitarray.h
--- old/bitarray-2.8.1/bitarray/bitarray.h 2023-08-07 01:06:01.000000000
+0200
+++ new/bitarray-2.8.2/bitarray/bitarray.h 2023-10-03 11:35:05.000000000
+0200
@@ -4,7 +4,7 @@
Author: Ilan Schnell
*/
-#define BITARRAY_VERSION "2.8.1"
+#define BITARRAY_VERSION "2.8.2"
#ifdef STDC_HEADERS
#include <stddef.h>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bitarray-2.8.1/bitarray/test_bitarray.py
new/bitarray-2.8.2/bitarray/test_bitarray.py
--- old/bitarray-2.8.1/bitarray/test_bitarray.py 2023-08-07
01:06:01.000000000 +0200
+++ new/bitarray-2.8.2/bitarray/test_bitarray.py 2023-10-03
11:35:05.000000000 +0200
@@ -275,8 +275,6 @@
(2**62, 2**59), (2**63-8, 2**60-1)]:
self.assertEqual(bits2bytes(n), m)
-tests.append(TestsModuleFunctions)
-
# ---------------------------------------------------------------------------
class CreateObjectTests(unittest.TestCase, Util):
@@ -614,8 +612,6 @@
a = None
self.assertRaises(ReferenceError, len, b)
-tests.append(CreateObjectTests)
-
# ---------------------------------------------------------------------------
class ToObjectsTests(unittest.TestCase, Util):
@@ -634,8 +630,6 @@
for a in self.randombitarrays():
self.assertEqual(tuple(a), tuple(a.tolist()))
-tests.append(ToObjectsTests)
-
# ---------------------------------------------------------------------------
class MetaDataTests(unittest.TestCase):
@@ -663,10 +657,9 @@
a = bitarray(n)
self.assertEqual(len(a), n)
-tests.append(MetaDataTests)
-
# ---------------------------------------------------------------------------
+@skipIf(not DEBUG)
class InternalTests(unittest.TestCase, Util):
# Internal functionality exposed for the purpose of testing.
@@ -841,9 +834,6 @@
x2[i2:j2] = 1
self.check_overlap(b1, b2, (x1 & x2).any())
-if DEBUG:
- tests.append(InternalTests)
-
# ---------------------------------------------------------------------------
class SliceTests(unittest.TestCase, Util):
@@ -1415,8 +1405,6 @@
del lst[::step]
self.assertEqual(a.tolist(), lst)
-tests.append(SliceTests)
-
# ---------------------------------------------------------------------------
class MaskedIndexTests(unittest.TestCase, Util):
@@ -1484,8 +1472,6 @@
# selecting the reverse mask `a = a[~mask]`
self.assertEqual(a[~mask], b)
-tests.append(MaskedIndexTests)
-
# ---------------------------------------------------------------------------
class SequenceIndexTests(unittest.TestCase, Util):
@@ -1628,8 +1614,6 @@
self.assertRaisesMessage(TypeError, msg, a.__setitem__, item, 1)
self.assertRaisesMessage(TypeError, msg, a.__delitem__, item)
-tests.append(SequenceIndexTests)
-
# ---------------------------------------------------------------------------
class MiscTests(unittest.TestCase, Util):
@@ -1793,9 +1777,6 @@
if sys.platform != "win32":
self.assertFalse(isinstance(a, abc.Hashable))
-
-tests.append(MiscTests)
-
# ---------------------------------------------------------------------------
class PickleTests(unittest.TestCase, Util):
@@ -1962,8 +1943,6 @@
self.assertEQUAL(a, b)
self.check_obj(b)
-tests.append(PickleTests)
-
# ---------------------------------------------------------------------------
class RichCompareTests(unittest.TestCase, Util):
@@ -2061,8 +2040,6 @@
self.check(a, b, aa, bb)
self.check(a, b, aa, bb)
-tests.append(RichCompareTests)
-
# ---------------------------------------------------------------------------
class SpecialMethodTests(unittest.TestCase, Util):
@@ -2182,8 +2159,6 @@
a = bitarray(8000)
self.assertTrue(sys.getsizeof(a) > 1000)
-tests.append(SpecialMethodTests)
-
# ---------------------------------------------------------------------------
class SequenceMethodsTests(unittest.TestCase, Util):
@@ -2351,8 +2326,6 @@
('011', True), ('0001', True), ('00011', False)]:
self.assertEqual(bitarray(s) in a, r)
-tests.append(SequenceMethodsTests)
-
# ---------------------------------------------------------------------------
class NumberTests(unittest.TestCase, Util):
@@ -2628,8 +2601,6 @@
a >>= 4
self.assertEqual(a, bitarray('0000001'))
-tests.append(NumberTests)
-
# ---------------------------------------------------------------------------
class ExtendTests(unittest.TestCase, Util):
@@ -2840,8 +2811,6 @@
self.assertEqual(len(a), 2 * len(s))
self.check_obj(a)
-tests.append(ExtendTests)
-
# ---------------------------------------------------------------------------
class MethodTests(unittest.TestCase, Util):
@@ -3121,8 +3090,6 @@
self.assertEqual(a, bitarray(len(a) * [val]))
self.check_obj(a)
-tests.append(MethodTests)
-
# ---------------------------------------------------------------------------
class ByteReverseTests(unittest.TestCase, Util):
@@ -3205,8 +3172,6 @@
a = bitarray(a, self.opposite_endian(a.endian()))
self.assertEqual(a.tobytes(), b.tobytes())
-tests.append(ByteReverseTests)
-
# ---------------------------------------------------------------------------
class CountTests(unittest.TestCase, Util):
@@ -3338,8 +3303,6 @@
self.assertEqual(a.count(v, i, j, step),
a[i:j:step].count(v))
-tests.append(CountTests)
-
# ---------------------------------------------------------------------------
class IndexTests(unittest.TestCase, Util):
@@ -3519,8 +3482,6 @@
else:
self.assertEqual(a.index(b, i, j), ref)
-tests.append(IndexTests)
-
# ---------------------------------------------------------------------------
class SearchTests(unittest.TestCase, Util):
@@ -3610,8 +3571,6 @@
for p in a.itersearch(b):
self.assertEqual(a[p:p + len(b)], b)
-tests.append(SearchTests)
-
# ---------------------------------------------------------------------------
class BytesTests(unittest.TestCase, Util):
@@ -3818,8 +3777,6 @@
self.assertRaises(TypeError, a.pack, '1')
self.assertRaises(TypeError, a.pack, [1, 3])
-tests.append(BytesTests)
-
# ---------------------------------------------------------------------------
class DescriptorTests(unittest.TestCase, Util):
@@ -3841,8 +3798,6 @@
self.assertTrue(b.readonly)
self.assertIsInstance(b.readonly, bool)
-tests.append(DescriptorTests)
-
# ---------------------------------------------------------------------------
class FileTests(unittest.TestCase, Util):
@@ -4145,8 +4100,6 @@
self.assertEqual(a[:8 * 994], 994 * bitarray('1000 1001'))
self.assertEqual(a[8 * 994:].tobytes(), b'Veedon')
-tests.append(FileTests)
-
# ----------------------------- Decode Tree ---------------------------------
alphabet_code = {
@@ -4250,8 +4203,6 @@
self.assertEqual(t.nodes(), 2047)
self.assertTrue(sys.getsizeof(t) > 10000)
-tests.append(DecodeTreeTests)
-
# ------------------ variable length encoding and decoding ------------------
class PrefixCodeTests(unittest.TestCase, Util):
@@ -4512,8 +4463,6 @@
self.assertEqual(''.join(a.iterdecode(t)), message)
self.check_obj(a)
-tests.append(PrefixCodeTests)
-
# --------------------------- Buffer Import ---------------------------------
class BufferImportTests(unittest.TestCase, Util):
@@ -4732,8 +4681,6 @@
self.assertRaises(BufferError, a.__delitem__, 0)
self.check_obj(a)
-tests.append(BufferImportTests)
-
# --------------------------- Buffer Export ---------------------------------
class BufferExportTests(unittest.TestCase, Util):
@@ -4835,8 +4782,6 @@
self.assertEqual(a.tobytes(), b'\x00ABC\x00')
self.check_obj(a)
-tests.append(BufferExportTests)
-
# ---------------------------------------------------------------------------
class TestsFrozenbitarray(unittest.TestCase, Util):
@@ -5031,14 +4976,10 @@
self.check_obj(g)
self.assertEqual(g.foo, 42)
-tests.append(TestsFrozenbitarray)
-
# ---------------------------------------------------------------------------
-def run(verbosity=1, repeat=1):
+def run(verbosity=1):
import bitarray.test_util
- all_tests = list(tests)
- all_tests.extend(bitarray.test_util.tests)
default_endian = get_default_endian()
print('bitarray is installed in: %s' % os.path.dirname(__file__))
@@ -5051,16 +4992,15 @@
print('__clang__ or __GNUC__ defined: %s' % SYSINFO[5])
print('PY_LITTLE_ENDIAN (use word shift): %s' % SYSINFO[7])
print('DEBUG: %s' % DEBUG)
+ loader = unittest.TestLoader()
suite = unittest.TestSuite()
- for cls in all_tests:
- for _ in range(repeat):
- suite.addTest(unittest.makeSuite(cls))
+ suite.addTests(loader.loadTestsFromModule(sys.modules[__name__]))
+ suite.addTests(loader.loadTestsFromModule(bitarray.test_util))
runner = unittest.TextTestRunner(verbosity=verbosity)
result = runner.run(suite)
_set_default_endian(default_endian)
return result
-
if __name__ == '__main__':
- run()
+ unittest.main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bitarray-2.8.1/bitarray/test_util.py
new/bitarray-2.8.2/bitarray/test_util.py
--- old/bitarray-2.8.1/bitarray/test_util.py 2023-08-07 01:06:01.000000000
+0200
+++ new/bitarray-2.8.2/bitarray/test_util.py 2023-10-03 11:35:05.000000000
+0200
@@ -39,8 +39,6 @@
else:
from io import BytesIO as StringIO
-tests = [] # type: list
-
# ---------------------------------------------------------------------------
class TestsZeros(unittest.TestCase):
@@ -80,8 +78,6 @@
# endian wrong string
self.assertRaises(ValueError, zeros, 0, 'foo')
-tests.append(TestsZeros)
-
# ---------------------------------------------------------------------------
class TestsURandom(unittest.TestCase):
@@ -122,8 +118,6 @@
self.assertRaises(TypeError, urandom, 0, 1)
self.assertRaises(ValueError, urandom, 0, 'foo')
-tests.append(TestsURandom)
-
# ---------------------------------------------------------------------------
class TestsPPrint(unittest.TestCase):
@@ -195,8 +189,6 @@
finally:
shutil.rmtree(tmpdir)
-tests.append(TestsPPrint)
-
# ---------------------------------------------------------------------------
class TestsMakeEndian(unittest.TestCase, Util):
@@ -242,8 +234,6 @@
self.assertTrue(b is a)
self.assertEQUAL(a, aa)
-tests.append(TestsMakeEndian)
-
# ---------------------------------------------------------------------------
class TestsRIndex(unittest.TestCase, Util):
@@ -349,8 +339,6 @@
a[randint(0, N - 1)] = 1
self.assertEqual(rindex(a), a.index(1))
-tests.append(TestsRIndex)
-
# ---------------------------------------------------------------------------
class TestsStrip(unittest.TestCase, Util):
@@ -413,8 +401,6 @@
self.assertEqual(strip(a, 'both'), bitarray('1'))
self.assertEqual(len(a), n)
-tests.append(TestsStrip)
-
# ---------------------------------------------------------------------------
class TestsCount_N(unittest.TestCase, Util):
@@ -568,8 +554,6 @@
# n = 0 -> count_n always 0
self.assertEqual(count_n(a, 0, v), 0)
-tests.append(TestsCount_N)
-
# ---------------------------------------------------------------------------
class TestsBitwiseCount(unittest.TestCase, Util):
@@ -659,8 +643,6 @@
self.assertEqual(all(a ^ b), count_xor(a, b) == n)
self.assertEqual(all(a ^ b), a == ~b)
-tests.append(TestsBitwiseCount)
-
# ---------------------------------------------------------------------------
class TestsBitwiseAny(unittest.TestCase, Util):
@@ -712,8 +694,6 @@
a[i] = 1
self.assertEqual(b[i], any_and(a, b))
-tests.append(TestsBitwiseAny)
-
# ---------------------------------------------------------------------------
class TestsSubset(unittest.TestCase, Util):
@@ -763,8 +743,6 @@
a.setall(1)
self.check(b, a, True)
-tests.append(TestsSubset)
-
# ---------------------------------------------------------------------------
class TestsCorrespondAll(unittest.TestCase, Util):
@@ -802,8 +780,6 @@
self.assertEqual(res[1] + res[2], count_xor(a, b))
self.assertEqual(sum(res), n)
-tests.append(TestsCorrespondAll)
-
# ---------------------------------------------------------------------------
class TestsParity(unittest.TestCase, Util):
@@ -842,8 +818,6 @@
self.assertEqual(parity(a), a.count() % 2)
self.assertEqual(a, b)
-tests.append(TestsParity)
-
# ---------------------------------------------------------------------------
class TestsIntervals(unittest.TestCase, Util):
@@ -904,8 +878,6 @@
self.assertEqual(a, b)
-tests.append(TestsIntervals)
-
# ---------------------------------------------------------------------------
class TestsHexlify(unittest.TestCase, Util):
@@ -1000,8 +972,6 @@
b.frombytes(binascii.unhexlify(s))
self.assertEQUAL(hex2ba(s, 'big'), b)
-tests.append(TestsHexlify)
-
# ---------------------------------------------------------------------------
class TestsBase(unittest.TestCase, Util):
@@ -1160,8 +1130,6 @@
b = bitarray(a, 'big')
self.assertEQUAL(base2ba(n, ba2base(n, b), 'big'), b)
-tests.append(TestsBase)
-
# ---------------------------------------------------------------------------
class SC_Tests(unittest.TestCase, Util):
@@ -1392,11 +1360,15 @@
a.setall(0)
m = 2 # head byte and stop byte
m += bits2bytes(n.bit_length()) # size bytes
- # For smaller or equal to 1 << 32, we have only one type 4 block.
- m += bool(n > 0) # number of blocks (head bytes)
- m += bool(n > 256) # number of second block heads
- b = sc_encode(a)
- self.assertEqual(m, len(b))
+ #print(i, n, m, sc_encode(a))
+ self.assertEqual(m, len(sc_encode(a)))
+ self.round_trip(a)
+
+ a[0] = 1
+ m += 2 # block head byte and one index byte
+ m += 2 * bool(n > 512) # second block head and second index byte
+ m += bool(n > 65536) # third index byte
+ self.assertEqual(m, len(sc_encode(a)))
self.round_trip(a)
a = zeros(1 << 25, 'big')
@@ -1457,8 +1429,6 @@
seg_pop = a.count(1, segbits * i, segbits * (i + 1))
self.assertEqual(rts[i + 1] - rts[i], seg_pop)
-tests.append(SC_Tests)
-
# ---------------------------------------------------------------------------
class VLFTests(unittest.TestCase, Util):
@@ -1605,8 +1575,6 @@
for a in self.randombitarrays():
self.round_trip(a)
-tests.append(VLFTests)
-
# ---------------------------------------------------------------------------
class TestsIntegerization(unittest.TestCase, Util):
@@ -1804,8 +1772,6 @@
self.assertEqual(i, self.twos_complement(j, len(a)))
-tests.append(TestsIntegerization)
-
# ---------------------------------------------------------------------------
class MixedTests(unittest.TestCase, Util):
@@ -1904,8 +1870,6 @@
# the 1000th prime is 7919
self.assertEqual(count_n(sieve, 1000) - 1, 7919)
-tests.append(MixedTests)
-
# ---------------------------------------------------------------------------
class TestsSerialization(unittest.TestCase, Util):
@@ -2004,8 +1968,6 @@
self.assertEqual(a.endian(), c.endian())
self.check_obj(c)
-tests.append(TestsSerialization)
-
# ---------------------------------------------------------------------------
class TestsHuffman(unittest.TestCase):
@@ -2101,8 +2063,6 @@
code = huffman_code({i: random() for i in range(n)})
self.check_tree(code)
-tests.append(TestsHuffman)
-
# ---------------------------------------------------------------------------
class TestsCanonicalHuffman(unittest.TestCase, Util):
@@ -2360,25 +2320,7 @@
freq = {i: random() for i in range(n)}
self.check_code(*canonical_huffman(freq))
-
-tests.append(TestsCanonicalHuffman)
-
# ---------------------------------------------------------------------------
-def run(verbosity=1):
- import bitarray
-
- print('bitarray.util is installed in: %s' % os.path.dirname(__file__))
- print('bitarray version: %s' % bitarray.__version__)
- print('Python version: %s' % sys.version)
-
- suite = unittest.TestSuite()
- for cls in tests:
- suite.addTest(unittest.makeSuite(cls))
-
- runner = unittest.TextTestRunner(verbosity=verbosity)
- return runner.run(suite)
-
-
if __name__ == '__main__':
- run()
+ unittest.main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bitarray-2.8.1/doc/changelog.rst
new/bitarray-2.8.2/doc/changelog.rst
--- old/bitarray-2.8.1/doc/changelog.rst 2023-08-07 01:06:01.000000000
+0200
+++ new/bitarray-2.8.2/doc/changelog.rst 2023-10-03 11:35:05.000000000
+0200
@@ -1,6 +1,17 @@
Change log
==========
+**2.8.2** (2023-10-03):
+
+* update cibuildwheel to 2.16.1 in order to provide cp312 wheels on PyPI
+* improve error messages for masked assignment
+* simplify test collection
+* added ``pytest.ini`` to allow running pytest with no additional arguments,
+ see `#208 <https://github.com/ilanschnell/bitarray/issues/208>`__
+* ``util.sc_encode()``: avoid writing empty blocks at end of compressed
+ stream, ie. skip encoding when total population count is reached
+
+
**2.8.1** (2023-08-06):
* use reconstructor function for pickling, see `#207
<https://github.com/ilanschnell/bitarray/issues/207>`__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bitarray-2.8.1/doc/reference.rst
new/bitarray-2.8.2/doc/reference.rst
--- old/bitarray-2.8.1/doc/reference.rst 2023-08-07 01:06:01.000000000
+0200
+++ new/bitarray-2.8.2/doc/reference.rst 2023-10-03 11:35:05.000000000
+0200
@@ -1,7 +1,7 @@
Reference
=========
-bitarray version: 2.8.1 -- `change log
<https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
+bitarray version: 2.8.2 -- `change log
<https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
In the following, ``item`` and ``value`` are usually a single bit -
an integer 0 or 1.
@@ -291,7 +291,7 @@
New in version 1.3.
-``test(verbosity=1, repeat=1)`` -> TextTestResult
+``test(verbosity=1)`` -> TextTestResult
Run self-test, and return unittest.runner.TextTestResult object.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bitarray-2.8.1/examples/sparse/compress.py
new/bitarray-2.8.2/examples/sparse/compress.py
--- old/bitarray-2.8.1/examples/sparse/compress.py 2023-08-07
01:06:01.000000000 +0200
+++ new/bitarray-2.8.2/examples/sparse/compress.py 2023-10-03
11:35:05.000000000 +0200
@@ -100,7 +100,7 @@
assert stat['endian'] == 'little'
assert stat['nbits'] == 1 << 33
blocks = stat['blocks']
- for i, n in enumerate([64, 754, 46, 48, 2]):
+ for i, n in enumerate([64, 754, 46, 48, 1]):
print(" block type %d %8d" % (i, blocks[i]))
assert blocks[i] == n
if sys.version_info[:2] >= (3, 10):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/bitarray-2.8.1/pytest.ini
new/bitarray-2.8.2/pytest.ini
--- old/bitarray-2.8.1/pytest.ini 1970-01-01 01:00:00.000000000 +0100
+++ new/bitarray-2.8.2/pytest.ini 2023-10-03 11:35:05.000000000 +0200
@@ -0,0 +1,14 @@
+# This file merely exists to allow running the tests using pytest without
+# additional options. That is (from the source tree):
+#
+# $ pytest
+#
+# The bitarray tests themselves do not depend on pytest, and the recommended
+# way to run the tests is (from the source tree on in an installed system):
+#
+# $ python -c 'import bitarray; assert bitarray.test().wasSuccessful()'
+#
+# Unlike just running pytest, this will provide useful debug information.
+
+[pytest]
+testpaths = bitarray