本文整理匯總了Python中src.transaction.Transaction.set_asset方法的典型用法代碼示例。如果您正苦於以下問題:Python Transaction.set_asset方法的具體用法?Python Transaction.set_asset怎麽用?Python Transaction.set_asset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類src.transaction.Transaction
的用法示例。
在下文中一共展示了Transaction.set_asset方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: transaction__set_asset
# 需要導入模塊: from src.transaction import Transaction [as 別名]
# 或者: from src.transaction.Transaction import set_asset [as 別名]
def transaction__set_asset(self, args):
import os
from src.bank import Bank
from src.household import Household
from src.firm import Firm
from src.environment import Environment
from src.transaction import Transaction
text = "This test checks transaction.set_asset \n"
self.print_info(text)
#
# INITIALIZATION
#
environment_directory = str(args[0])
identifier = str(args[1])
log_directory = str(args[2])
# Configure logging parameters so we get output while the program runs
logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %H:%M:%S',
filename=log_directory + identifier + ".log", level=logging.INFO)
logging.info('START logging for test transaction__set_asset in run: %s',
environment_directory + identifier + ".xml")
# Construct household filename
environment = Environment(environment_directory, identifier)
#
# TESTING
#
print("Creating a transaction")
transaction = Transaction()
transaction.asset = "test_asset"
print("Asset: ")
print(transaction.get_asset())
print("Setting asset")
transaction.set_asset("new_asset")
print("Asset: ")
print(transaction.get_asset())