From b14698071cadf6d95fbc2e176ab530d686bcc318 Mon Sep 17 00:00:00 2001 From: Kevin Phoenix Date: Mon, 15 Jul 2024 13:44:03 -0700 Subject: [PATCH] Fix all warnings in test cases --- tests/test_ast.py | 4 ++-- tests/test_expression.py | 18 +++++++++--------- tests/test_simplify.py | 2 +- tests/test_solver.py | 2 +- tests/test_vsa.py | 12 ++++++------ 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/test_ast.py b/tests/test_ast.py index 806d0bafe..489ad7022 100644 --- a/tests/test_ast.py +++ b/tests/test_ast.py @@ -29,8 +29,8 @@ def test_associativity(self): assert (x * y * z * w).shallow_repr() == "" assert (x + y - z - w).shallow_repr() == "" assert (x + (y - (z - w))).shallow_repr() == "" - assert (x * y / z % w).shallow_repr() == "" - assert (x * (y / (z % w))).shallow_repr() == "" + assert (x * y // z % w).shallow_repr() == "" + assert (x * (y // (z % w))).shallow_repr() == "" if __name__ == "__main__": diff --git a/tests/test_expression.py b/tests/test_expression.py index e9bedbe94..927e225ce 100644 --- a/tests/test_expression.py +++ b/tests/test_expression.py @@ -283,7 +283,7 @@ def raw_ite(self, solver_type): ss = s.branch() ss.add(z == itz) ss.add(itz != 0) - self.assertEqual(ss.eval(y / x, 100), (2,)) + self.assertEqual(ss.eval(y // x, 100), (2,)) self.assertEqual(sorted(ss.eval(x, 100)), [1, 10, 100]) self.assertEqual(sorted(ss.eval(y, 100)), [2, 20, 200]) @@ -447,10 +447,10 @@ def test_signed_concrete(self): d = claripy.BVV(-3, 32) # test unsigned - assert bc.convert(a / c) == 1 - assert bc.convert(a / d) == 0 - assert bc.convert(b / c) == 0x55555553 - assert bc.convert(b / d) == 0 + assert bc.convert(a // c) == 1 + assert bc.convert(a // d) == 0 + assert bc.convert(b // c) == 0x55555553 + assert bc.convert(b // d) == 0 assert bc.convert(a % c) == 2 assert bc.convert(a % d) == 5 assert bc.convert(b % c) == 2 @@ -478,10 +478,10 @@ def test_signed_symbolic(self): solver.add(d == -3) # test unsigned - assert list(solver.eval(a / c, 2)) == [1] - assert list(solver.eval(a / d, 2)) == [0] - assert list(solver.eval(b / c, 2)) == [0x55555553] - assert list(solver.eval(b / d, 2)) == [0] + assert list(solver.eval(a // c, 2)) == [1] + assert list(solver.eval(a // d, 2)) == [0] + assert list(solver.eval(b // c, 2)) == [0x55555553] + assert list(solver.eval(b // d, 2)) == [0] assert list(solver.eval(a % c, 2)) == [2] assert list(solver.eval(a % d, 2)) == [5] assert list(solver.eval(b % c, 2)) == [2] diff --git a/tests/test_simplify.py b/tests/test_simplify.py index 85952f08d..036a13cf0 100644 --- a/tests/test_simplify.py +++ b/tests/test_simplify.py @@ -49,7 +49,7 @@ def assert_correct(a, b): # make sure the division simplification works assert_correct(2 + x, claripy.backends.z3.simplify(1 + x + 1)) - assert_correct(x / y, claripy.backends.z3.simplify(x / y)) + assert_correct(x // y, claripy.backends.z3.simplify(x // y)) assert_correct(x % y, claripy.backends.z3.simplify(x % y)) def test_rotate_shift_mask_simplification(self): diff --git a/tests/test_solver.py b/tests/test_solver.py index e15288214..88c14e2b5 100644 --- a/tests/test_solver.py +++ b/tests/test_solver.py @@ -544,7 +544,7 @@ def test_zero_division_in_cache_mixin(self): s = claripy.Solver() s.add(e == 8) assert s.satisfiable() - s.add(claripy.If(denum == 0, 0, num / denum) == e) + s.add(claripy.If(denum == 0, 0, num // denum) == e) assert s.satisfiable() # As a bonus: s.add(num == 16) diff --git a/tests/test_vsa.py b/tests/test_vsa.py index 570e77b09..28645372c 100644 --- a/tests/test_vsa.py +++ b/tests/test_vsa.py @@ -185,16 +185,16 @@ def test_wrapped_intervals(self): si1 = claripy.SI(bits=32, to_conv=10) si2 = claripy.SI(bits=32, to_conv=5) si3 = claripy.SI(bits=32, to_conv=2) - assert claripy.backends.vsa.identical(si1 / si2, si3) + assert claripy.backends.vsa.identical(si1 // si2, si3) si3 = claripy.SI(bits=32, to_conv=0) - assert claripy.backends.vsa.identical(si2 / si1, si3) + assert claripy.backends.vsa.identical(si2 // si1, si3) # intervals division si1 = claripy.SI(bits=32, stride=1, lower_bound=10, upper_bound=100) si2 = claripy.SI(bits=32, stride=1, lower_bound=10, upper_bound=20) si3 = claripy.SI(bits=32, stride=1, lower_bound=0, upper_bound=10) - assert claripy.backends.vsa.identical(si1 / si2, si3) + assert claripy.backends.vsa.identical(si1 // si2, si3) # # Extension @@ -381,10 +381,10 @@ def is_equal(ast_0, ast_1): assert si_mul_3.size() == 32 assert is_equal(si_mul_3, claripy.SI(bits=32, stride=2, lower_bound=-2000, upper_bound=4000)) # Division - si_div_1 = si1 / 3 + si_div_1 = si1 // 3 assert si_div_1.size() == 32 assert is_equal(si_div_1, claripy.SI(bits=32, stride=0, lower_bound=3, upper_bound=3)) - si_div_2 = si_a / 3 + si_div_2 = si_a // 3 assert si_div_2.size() == 32 assert is_equal(si_div_2, claripy.SI(bits=32, stride=1, lower_bound=3, upper_bound=6)) # Modulo @@ -566,7 +566,7 @@ def is_equal(ast_0, ast_1): # ValueSet # - def VS(name=None, bits=None, region=None, val=None): + def VS(name=None, bits=None, region=None, val=None): # noqa: F811 region = "foobar" if region is None else region return claripy.ValueSet(bits, region=region, region_base_addr=0, value=val, name=name)