Skip to content

Commit

Permalink
Ensures tests start with known state
Browse files Browse the repository at this point in the history
  • Loading branch information
mhostetter committed Aug 31, 2022
1 parent 498e26f commit f5abfac
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/fields/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ def test_defaults(characteristic, degree):


def test_defaults_dont_modify_ufunc_mode():
# Ensure display=None (the default) doesn't modify the current ufunc mode
"""
Ensures ufunc_mode=None (the default) doesn't modify the current ufunc mode.
"""
GF = galois.GF(2**8)
GF.compile("auto") # Reset to default
assert GF.ufunc_mode == "jit-lookup"
GF.compile("jit-calculate")
assert GF.ufunc_mode == "jit-calculate"
Expand All @@ -29,6 +32,7 @@ def test_defaults_dont_modify_ufunc_mode():

def test_can_modify_ufunc_mode():
GF = galois.GF(2**8)
GF.compile("auto") # Reset to default
assert GF.ufunc_mode == "jit-lookup"
GF = galois.GF(2**8, compile="jit-calculate")
assert GF.ufunc_mode == "jit-calculate"
Expand All @@ -37,8 +41,11 @@ def test_can_modify_ufunc_mode():


def test_defaults_dont_modify_display_mode():
# Ensure display=None (the default) doesn't modify the current display mode
"""
Ensures display=None (the default) doesn't modify the current display mode.
"""
GF = galois.GF(2**8)
GF.display() # Reset to default
assert GF.display_mode == "int"
GF.display("poly")
assert GF.display_mode == "poly"
Expand All @@ -50,6 +57,7 @@ def test_defaults_dont_modify_display_mode():

def test_can_modify_display_mode():
GF = galois.GF(2**8)
GF.display() # Reset to default
assert GF.display_mode == "int"
GF = galois.GF(2**8, display="poly")
assert GF.display_mode == "poly"
Expand Down

0 comments on commit f5abfac

Please sign in to comment.