From c50c2d76f04cb16f7657d0f71ee5c8e0dcfc44f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20DA=20ROCHA?= <sebastien@da-rocha.net> Date: Fri, 17 Aug 2018 00:07:25 +0200 Subject: [PATCH] [enh] Add a test on silkaj.tx.truncBase as an example to parametrized test --- tests/test_unit_tx.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/test_unit_tx.py diff --git a/tests/test_unit_tx.py b/tests/test_unit_tx.py new file mode 100644 index 00000000..f2e6375d --- /dev/null +++ b/tests/test_unit_tx.py @@ -0,0 +1,14 @@ +import pytest + +from silkaj.tx import truncBase + + +@pytest.mark.parametrize('amount,base,expected', [ + (0, 0, 0), + (10, 2, 0), + (100, 2, 100), + (306, 2, 300), + (3060, 3, 3000), +]) +def test_truncBase(amount, base, expected): + assert truncBase(amount, base) == expected -- GitLab