Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitwise test fails #127

Closed
stephen-bracken opened this issue Jun 11, 2021 · 2 comments
Closed

Bitwise test fails #127

stephen-bracken opened this issue Jun 11, 2021 · 2 comments

Comments

@stephen-bracken
Copy link

I ran your package tests for versions 1.9.2 and 2.1 and discovered that the tests test_bitwise and test_bitwise_inplace failed on two separate installations.

Here is the anaconda output for the tests on 1.9.2

>python -m unittest discover c:\programdata\anaconda3\lib\site-packages\bitarray
.......................................................................................................................................................................................................................................FF.........................................................................................
======================================================================
FAIL: test_bitwise (test_util.MixedTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\programdata\anaconda3\lib\site-packages\bitarray\test_util.py", line 1110, in test_bitwise
    self.assertEqual(ba2int(c << n), i << n)
AssertionError: 2 != 4

======================================================================
FAIL: test_bitwise_inplace (test_util.MixedTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\programdata\anaconda3\lib\site-packages\bitarray\test_util.py", line 1139, in test_bitwise_inplace
    self.assertEqual(ba2int(c), i << n)
AssertionError: 4 != 8

----------------------------------------------------------------------
Ran 322 tests in 0.352s

FAILED (failures=2)
@ilanschnell
Copy link
Owner

Thanks for reporting this issue and using bitarray. I see the same two errors when running the tests with python -m unittest discover, but not when calling bitarray's test function (python -c "import bitarray; bitarray.test()"). This is very strange. I'll look into it. Thanks again

@ilanschnell
Copy link
Owner

I've fixed two failing tests by adding adding the endianness explicitly to the zeros() function. The two different ways of running the tests must have an impact on the order the tests and run, and some of them change the default endianness. Anyway, being explicit here is a good thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants