Skip to content

Commit

Permalink
beautify
Browse files Browse the repository at this point in the history
As title
  • Loading branch information
esc committed Jan 30, 2025
1 parent 06e7c7c commit cf86463
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions numba_rvsdg/tests/test_ast_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,9 +1229,8 @@ def function(x: int) -> int:

def test_and(self):
def function(x: int, y: int) -> int:
return (
x and y
) # Returns last truthy value, or False if any others are falsy
# Returns last truthy value, or False if any others are falsy.
return x and y

expected = {
"0": {
Expand All @@ -1257,9 +1256,8 @@ def function(x: int, y: int) -> int:

def test_or(self):
def function(x: int, y: int) -> int:
return (
x or y
) # Returns first truthy value, or last value if all falsy
# Returns first truthy value, or last value if all falsy.
return x or y

expected = {
"0": {
Expand All @@ -1286,9 +1284,9 @@ def function(x: int, y: int) -> int:
function,
expected,
arguments=[
(1, 0), # First value truthy
(0, 2), # First value falsy, second truthy
(0, 0), # All values falsy - returns last value
(1, 0), # First value truthy.
(0, 2), # First value falsy, second truthy.
(0, 0), # All values falsy - returns last value.
],
)

Expand Down Expand Up @@ -1333,14 +1331,14 @@ def function(x: int, y: int, z: int) -> bool:
function,
expected,
arguments=[
(0, 0, 0), # All false
(0, 0, 1), # Only z true - short circuits at x
(0, 1, 0), # Only y true - short circuits at x
(0, 1, 1), # y and z true - short circuits at x
(1, 0, 0), # Only x true - short circuits at y
(1, 0, 1), # x and z true - short circuits at y
(1, 1, 0), # x and y true - fails at z
(1, 1, 1), # All true - complete evaluation
(0, 0, 0), # All false.
(0, 0, 1), # Only z true - short circuits at x.
(0, 1, 0), # Only y true - short circuits at x.
(0, 1, 1), # y and z true - short circuits at x.
(1, 0, 0), # Only x true - short circuits at y.
(1, 0, 1), # x and z true - short circuits at y.
(1, 1, 0), # x and y true - fails at z.
(1, 1, 1), # All true - complete evaluation.
],
)

Expand Down Expand Up @@ -1538,7 +1536,7 @@ def function(a: int, b: int) -> int:
],
)

def test_while_bool_ops(self):
def test_while_with_bool_ops(self):
def function(x: int, y: int) -> int:
count = 0
while x and y:
Expand Down

0 comments on commit cf86463

Please sign in to comment.