def test_from_tx_with_ctransaction_argument(self): tx = CTransaction() chainparams.set_to_preset('Peercoin') self.assertRaises(AttributeError, getattr, tx, 'Timestamp') tx2 = Transaction.from_tx(tx) self.assertIs(tx.__class__, CTransaction) self.assertEqual(tx2.Timestamp, 0)
def test_from_tx_with_transaction_argument(self): tx = Transaction() chainparams.set_to_preset('Peercoin') self.assertRaises(AttributeError, getattr, tx, 'Timestamp') tx2 = Transaction.from_tx(tx) self.assertIsNot(tx, tx2) self.assertEqual(tx2.Timestamp, 0)
def coerce_tx(v): return Transaction.from_tx(v)
def set_tx(self, tx): """Reset the model to reflect tx.""" self.beginResetModel() self.tx = Transaction.from_tx(tx) self.endResetModel()