本文整理汇总了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