本文整理匯總了Python中pycalphad.Database.to_file方法的典型用法代碼示例。如果您正苦於以下問題:Python Database.to_file方法的具體用法?Python Database.to_file怎麽用?Python Database.to_file使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pycalphad.Database
的用法示例。
在下文中一共展示了Database.to_file方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_to_file_overwrites_with_if_exists_argument
# 需要導入模塊: from pycalphad import Database [as 別名]
# 或者: from pycalphad.Database import to_file [as 別名]
def test_to_file_overwrites_with_if_exists_argument():
"Database.to_file should overwrite if 'overwrite' is passed to if_exists"
fname = 'testwritedb.tdb'
test_dbf = Database(ALNIPT_TDB)
test_dbf.to_file(fname) # establish the initial file
inital_modification_time = os.path.getmtime(fname)
test_dbf.to_file(fname, if_exists='overwrite') # test if_exists behavior
overwrite_modification_time = os.path.getmtime(fname)
assert overwrite_modification_time > inital_modification_time
示例2: test_to_file_raises_with_bad_if_exists_argument
# 需要導入模塊: from pycalphad import Database [as 別名]
# 或者: from pycalphad.Database import to_file [as 別名]
def test_to_file_raises_with_bad_if_exists_argument():
"Database.to_file should raise if a bad behavior string is passed to if_exists"
fname = 'testwritedb.tdb'
test_dbf = Database(ALNIPT_TDB)
test_dbf.to_file(fname) # establish the initial file
test_dbf.to_file(fname, if_exists='TEST_BAD_ARGUMENT') # test if_exists behavior
示例3: test_to_file_defaults_to_raise_if_exists
# 需要導入模塊: from pycalphad import Database [as 別名]
# 或者: from pycalphad.Database import to_file [as 別名]
def test_to_file_defaults_to_raise_if_exists():
"Attempting to use Database.to_file should raise by default if it exists"
fname = 'testwritedb.tdb'
test_dbf = Database(ALNIPT_TDB)
test_dbf.to_file(fname) # establish the initial file
test_dbf.to_file(fname) # test if_exists behavior