diff --git a/bitcoinlib/db.py b/bitcoinlib/db.py index c52eaeb8..8994a6ed 100644 --- a/bitcoinlib/db.py +++ b/bitcoinlib/db.py @@ -119,7 +119,7 @@ def _import_config_data(ses): session.close() -def add_column(engine, table_name, column): +def add_column(engine, table_name, column): # pragma: no cover """ Used to add new column to database with migration and update scripts @@ -501,7 +501,7 @@ class DbTransactionOutput(Base): __table_args__ = (UniqueConstraint('transaction_id', 'output_n', name='constraint_transaction_output_unique'),) -def db_update_version_id(db, version): +def db_update_version_id(db, version): # pragma: no cover _logger.info("Updated BitcoinLib database to version %s" % version) db.session.query(DbConfig).filter(DbConfig.variable == 'version').update( {DbConfig.value: version}) @@ -509,7 +509,7 @@ def db_update_version_id(db, version): return version -def db_update(db, version_db, code_version=BITCOINLIB_VERSION): +def db_update(db, version_db, code_version=BITCOINLIB_VERSION): # pragma: no cover # Database changes from version 0.5+ # if version_db <= '0.6.3' and code_version > '0.6.3': diff --git a/tests/test_blocks.py b/tests/test_blocks.py index e4d0ecb3..4b40b74d 100644 --- a/tests/test_blocks.py +++ b/tests/test_blocks.py @@ -73,6 +73,13 @@ def test_blocks_parse_genesis(self): self.assertEqual(b.tx_count, 1) self.assertEqual(str(b), '') + t = b.parse_transaction() + self.assertEqual(t.outputs[0].address, '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa') + self.assertEqual(b.total_out, 0) + b.update_totals() + self.assertEqual(b.total_in, 0) + self.assertEqual(b.total_out, 5000000000) + def test_blocks_create_block(self): block_hash = '00000000000023b05c9ae15577257daf17029604eba0a58824e93306e44d0c62' diff --git a/tests/test_keys.py b/tests/test_keys.py index 1fc1fff5..969d5012 100644 --- a/tests/test_keys.py +++ b/tests/test_keys.py @@ -628,6 +628,12 @@ def test_hdkey_network_change(self): k.network_change('litecoin') self.assertEqual(k.address(), 'LPsPTgctprGZ6FEc7QFAugr6qg8XV3X4tg') + def test_hdkey_formats(self): + pkhex = '036e770e764c8c03acd620030c2844dd09d7c756ecedeb0521fe075301caf0e6ad' + k = HDKey(pkhex) + self.assertEqual(k.as_bytes(), bytes.fromhex(pkhex)) + self.assertEqual(k.as_hex(), pkhex) + class TestBip38(unittest.TestCase):