From 0dfc5505348b2ca40e0d94be07e322ecf3c73c71 Mon Sep 17 00:00:00 2001 From: woni <81616747+W0ni@users.noreply.github.com> Date: Mon, 19 Aug 2024 20:50:18 +0200 Subject: [PATCH] fix expression division and add test --- miasm/expression/expression.py | 4 ++-- test/expression/expression.py | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/miasm/expression/expression.py b/miasm/expression/expression.py index e5debb341..4b0bbe6bb 100644 --- a/miasm/expression/expression.py +++ b/miasm/expression/expression.py @@ -568,11 +568,11 @@ def __add__(self, other): def __sub__(self, other): return ExprOp('+', self, ExprOp('-', other)) - def __div__(self, other): + def __truediv__(self, other): return ExprOp('/', self, other) def __floordiv__(self, other): - return self.__div__(other) + return self.__truediv__(other) def __mod__(self, other): return ExprOp('%', self, other) diff --git a/test/expression/expression.py b/test/expression/expression.py index 9b0c2807f..fa3cf0f7e 100644 --- a/test/expression/expression.py +++ b/test/expression/expression.py @@ -80,16 +80,22 @@ C = A+B D = C + A +E = A / B +F = A // B +assert E is F assert A in A assert A in C assert B in C assert C in C +assert E in E assert A in D assert B in D assert C in D assert D in D +assert A in E +assert B in E assert C not in A assert C not in B