Skip to content

Commit

Permalink
MAINT: update test hash values
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Jan 11, 2024
1 parent 9f399a4 commit c1b6b02
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import logging
import os
import sys
from os.path import abspath, dirname
from typing import TYPE_CHECKING

Expand Down Expand Up @@ -53,12 +54,14 @@ def test_aslatex_isobar_node():
@pytest.mark.parametrize(
("assumptions", "expected_hash"),
[
(dict(), "pythonhashseed-0+7459658071388516764"),
(dict(real=True), "pythonhashseed-0+3665410414623666716"),
(dict(rational=True), "pythonhashseed-0-7926839224244779605"),
(dict(), (+7459658071388516764, +8778804591879682108)),
(dict(real=True), (+3665410414623666716, -7967572625470457155)),
(dict(rational=True), (-7926839224244779605, -8321323707982755013)),
],
)
def test_get_readable_hash(assumptions, expected_hash, caplog: LogCaptureFixture):
def test_get_readable_hash(
assumptions, expected_hash: tuple[int, int], caplog: LogCaptureFixture
):
caplog.set_level(logging.WARNING)
x, y = sp.symbols("x y", **assumptions)
expr = x**2 + y
Expand All @@ -70,7 +73,12 @@ def test_get_readable_hash(assumptions, expected_hash, caplog: LogCaptureFixture
assert "PYTHONHASHSEED has not been set." in caplog.text
caplog.clear()
elif python_hash_seed == "0":
assert h == expected_hash
if sys.version_info < (3, 11):
expected_hash = expected_hash[0]
else:
expected_hash = expected_hash[1]
expected = f"pythonhashseed-0{expected_hash:+d}"
assert h == expected
else:
pytest.skip("PYTHONHASHSEED has been set, but is not 0")
assert caplog.text == ""

0 comments on commit c1b6b02

Please sign in to comment.