diff options
| author | xmo-odoo <xmo@odoo.com> | 2019-11-08 11:07:10 +0000 |
|---|---|---|
| committer | fw-bot <otis@odoo.com> | 2019-11-08 13:05:17 +0000 |
| commit | 9b4e487a5c031ea94eeb9aaeb221591b6faa92b9 (patch) | |
| tree | 47a249bcbcd5ecfed8d8f29b323a55e4852309f2 | |
| parent | 931da033a5bad5b5e54576468b8cfe894b69cf3c (diff) | |
[FIX] point_of_sale: incorrect assertAlmostEqual
The third parameter to assertAlmostEqual is a precision (places), not the
assertion message. This goes unnoticed when using two objects which are
strictly equal because assertAlmostEqual shortcuts if the two inputs are equal,
before falling back on approximation.
Since the parameters here are two integers, they're always going to be either
identical or completely different, therefore the issue is only visible if the assertion
fails, hiding the assertion error.
* pass the message by keyword
* replace assertAlmostEqual by assertEqual as the inputs are integers and integers
can't really be "almost" equal
closes odoo/odoo#40030
X-original-commit: f22e71771f18ecffb06d56ae892c7db1c3984e3c
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
| -rw-r--r-- | addons/point_of_sale/tests/test_pos_basic_config.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/point_of_sale/tests/test_pos_basic_config.py b/addons/point_of_sale/tests/test_pos_basic_config.py index 607afafa47f..fa2bb6e01b7 100644 --- a/addons/point_of_sale/tests/test_pos_basic_config.py +++ b/addons/point_of_sale/tests/test_pos_basic_config.py @@ -394,7 +394,7 @@ class TestPoSBasicConfig(TestPoSCommon): session_move = self.pos_session.move_id sale_lines = session_move.line_ids.filtered(lambda line: line.account_id == self.sale_account) - self.assertAlmostEqual(len(sale_lines), 2, 'There should be lines for both sales and refund.') + self.assertEqual(len(sale_lines), 2, msg='There should be lines for both sales and refund.') self.assertAlmostEqual(sum(sale_lines.mapped('balance')), -110.0) receivable_line_bank = session_move.line_ids.filtered(lambda line: self.bank_pm.name in line.name) |
