From 5d79399f21ef8df87f36841b7d572d45644e253b Mon Sep 17 00:00:00 2001 From: lash Date: Fri, 10 Feb 2023 16:19:03 +0000 Subject: [PATCH] Finish removing redundant tests --- python/CHANGELOG | 1 + python/run_tests.sh | 2 +- python/tests/test_remainder.py | 70 ---------------------------------- 3 files changed, 2 insertions(+), 71 deletions(-) delete mode 100644 python/tests/test_remainder.py diff --git a/python/CHANGELOG b/python/CHANGELOG index 33dda13..4976f3c 100644 --- a/python/CHANGELOG +++ b/python/CHANGELOG @@ -4,6 +4,7 @@ * Add sealable features for supply, sink address, expiry and minters (when sealed cannot be changed) * Deployer script now takes demurrage amount as ppm instead of literal growth fraction * Retire old multi and cap contracts + * Replace contract bitfields for redistributions with structs - 0.1.1 * Settable demurrage steps for apply demurrage cli tool - 0.1.0 diff --git a/python/run_tests.sh b/python/run_tests.sh index b8e4beb..8c034d9 100644 --- a/python/run_tests.sh +++ b/python/run_tests.sh @@ -6,7 +6,7 @@ set -x default_pythonpath=$PYTHONPATH:. export PYTHONPATH=${default_pythonpath:-.} >&2 echo using pythonpath $PYTHONPATH -for f in `ls tests/*.py`; do +for f in `ls tests/test_*.py`; do python $f done set +x diff --git a/python/tests/test_remainder.py b/python/tests/test_remainder.py deleted file mode 100644 index 2155520..0000000 --- a/python/tests/test_remainder.py +++ /dev/null @@ -1,70 +0,0 @@ -# standard imports -import os -import unittest -import json -import logging -import math - -# external imports -from chainlib.eth.constant import ZERO_ADDRESS -from chainlib.eth.nonce import RPCNonceOracle -from chainlib.eth.tx import receipt -from chainlib.error import JSONRPCException -import eth_tester - -# local imports -from erc20_demurrage_token import DemurrageToken - -# test imports -from erc20_demurrage_token.unittest.base import TestDemurrageDefault - -logging.basicConfig(level=logging.DEBUG) -logg = logging.getLogger() - -testdir = os.path.dirname(__file__) - - -class Test(TestDemurrageDefault): - - def test_fractional_state(self): - nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc) - c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) - - with self.assertRaises(JSONRPCException): - o = c.remainder(self.address, 2, 1, sender_address=self.accounts[0]) - self.rpc.do(o) - - with self.assertRaises(JSONRPCException): - o = c.remainder(self.address, 0, 100001, sender_address=self.accounts[0]) - self.rpc.do(o) - - o = c.remainder(self.address, 1, 2, sender_address=self.accounts[0]) - r = self.rpc.do(o) - remainder = c.parse_remainder(r) - self.assertEqual(remainder, 0); - - whole = 5000001 - parts = 20000 - expect = whole - (math.floor(whole/parts) * parts) - o = c.remainder(self.address, parts, whole, sender_address=self.accounts[0]) - r = self.rpc.do(o) - remainder = c.parse_remainder(r) - self.assertEqual(remainder, expect) - - parts = 30000 - expect = whole - (math.floor(whole/parts) * parts) - o = c.remainder(self.address, parts, whole, sender_address=self.accounts[0]) - r = self.rpc.do(o) - remainder = c.parse_remainder(r) - self.assertEqual(remainder, expect) - - parts = 40001 - expect = whole - (math.floor(whole/parts) * parts) - o = c.remainder(self.address, parts, whole, sender_address=self.accounts[0]) - r = self.rpc.do(o) - remainder = c.parse_remainder(r) - self.assertEqual(remainder, expect) - - -if __name__ == '__main__': - unittest.main()