Closed peerchemist closed 6 years ago
Unit tests are not passing
Seems unrelated:
tests/unit.py:322: DeprecationWarning: generator 'TestStackData.get_test_data' raised StopIteration for data in stored_data:
No, that's a warning that always pops up during unit tests (if anyone has any idea on how to fix it, it would be very welcome, I tried something long ago but it didn't seem to work). Running unit tests on this PR I get:
======================================================================
ERROR: test_jsonization (tests.unit.TestTransaction)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/rael/Dropbox/projects/btcpy/tests/unit.py", line 248, in test_jsonization
self.assertEqual(TransactionFactory.from_json(tx.to_json()).to_json(), tx.to_json())
File "/home/rael/Dropbox/projects/btcpy/btcpy/structs/transaction.py", line 1005, in from_json
return cls._get_class(segwit=False, mutable=mutable).from_json(tx_json)
File "/home/rael/Dropbox/projects/btcpy/btcpy/structs/transaction.py", line 478, in from_json
tx = super().from_json(tx_json)
File "/home/rael/Dropbox/projects/btcpy/btcpy/structs/transaction.py", line 451, in from_json
ins=[TxIn.from_json(txin_json) for txin_json in tx_json['vin']],
File "/home/rael/Dropbox/projects/btcpy/btcpy/structs/transaction.py", line 451, in <listcomp>
ins=[TxIn.from_json(txin_json) for txin_json in tx_json['vin']],
File "/home/rael/Dropbox/projects/btcpy/btcpy/structs/transaction.py", line 170, in from_json
Sequence(int(dic['sequence'])), witness=witness)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'Sequence'
----------------------------------------------------------------------
Ran 123 tests in 175.516s
FAILED (errors=1)
Please make sure you are running tests with the command python3 -m unittest tests/unit.py
as specified here, otherwise you are running tests on the unmodified copy of btcpy installed in your environment.
Ah, I have made this PR from old(er) tag which does not have test_jsonization
as master is stuck with the pending PR.
Let's leave this open and revisit later once branches synchronize a bit.
Will do this from scratch.
This brings json closer to how json outputted by RPC node looks like.