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

fix(frontend-python): correct operator precedence #1155

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions frontends/concrete-python/tests/compilation/test_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def test_print(helpers):
class Module:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

inputset = list(range(20))
module = Module.compile(
Expand All @@ -369,11 +369,11 @@ def test_encrypted_execution():
class Module:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

@fhe.function({"x": "encrypted"})
def dec(x):
return x - 1 % 20
return (x - 1) % 20

inputset = [np.random.randint(1, 20, size=()) for _ in range(100)]
module = Module.compile(
Expand Down Expand Up @@ -407,11 +407,11 @@ def test_key_set():
class Module:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

@fhe.function({"x": "encrypted"})
def dec(x):
return x - 1 % 20
return (x - 1) % 20

inputset = [np.random.randint(1, 20, size=()) for _ in range(100)]
module = Module.compile(
Expand Down Expand Up @@ -596,11 +596,11 @@ def test_simulate_encrypt_run_decrypt(helpers):
class Module:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

@fhe.function({"x": "encrypted"})
def dec(x):
return x - 1 % 20
return (x - 1) % 20

inputset = [np.random.randint(1, 20, size=()) for _ in range(100)]
module = Module.compile(
Expand Down Expand Up @@ -808,7 +808,7 @@ def test_lazy_simulation_execution(helpers):
class Module1:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

module = Module1.compile(
{"inc": [np.random.randint(1, 20, size=()) for _ in range(100)]},
Expand All @@ -829,7 +829,7 @@ def inc(x):
class Module2:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

module = Module2.compile(
{"inc": [np.random.randint(1, 20, size=()) for _ in range(100)]},
Expand All @@ -848,7 +848,7 @@ def inc(x):
class Module3:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

module = Module3.compile(
{"inc": [np.random.randint(1, 20, size=()) for _ in range(100)]},
Expand All @@ -867,7 +867,7 @@ def inc(x):
class Module4:
@fhe.function({"x": "encrypted"})
def inc(x):
return x + 1 % 20
return (x + 1) % 20

module = Module4.compile(
{"inc": [np.random.randint(1, 20, size=()) for _ in range(100)]},
Expand Down
Loading