本文整理汇总了Python中test_utils.assert_str函数的典型用法代码示例。如果您正苦于以下问题:Python assert_str函数的具体用法?Python assert_str怎么用?Python assert_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_str函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: assert_doc_updates
def assert_doc_updates(doc):
"""Asserts a document after being updated.
:param object doc: Document being tested.
"""
tu.assert_str(doc.long_name, "X")
示例2: assert_doc_updates
def assert_doc_updates(doc):
"""Asserts a document after being updated.
:param object doc: Document being tested.
"""
tu.assert_str(doc.description, "X")
示例3: _test_set_option_01
def _test_set_option_01():
"""Test setting package options - positive."""
api_url = 'http://es-doc.org'
api_url_old = pyesdoc.get_option('api_url')
pyesdoc.set_option('api_url', api_url)
tu.assert_str(api_url, pyesdoc.get_option('api_url'))
pyesdoc.set_option('api_url', api_url_old)
示例4: _assert_doc_content
def _assert_doc_content(doc, is_update):
"""Assert content information."""
tu.assert_iter(doc.content, 1, cim.v1.DataContent)
c = doc.content[0]
tu.assert_object(c.topic, cim.v1.DataTopic)
tu.assert_str(c.topic.description, "missing CF name: tendency_of", True)
tu.assert_str(c.topic.name, "fossil_fuel_organic_carbon")
示例5: _test_create_02
def _test_create_02():
"""Test creating documents - 2."""
for ontology, version, package, typeof in pyesdoc.list_types():
doc = _create_doc(ontology, version, package, typeof)
_assert_doc(doc)
type_key = "{0}.{1}.{2}.{3}".format(ontology, version, package, typeof)
tu.assert_str(doc.__class__.type_key, type_key)
示例6: _assert_doc_hierarchy_level
def _assert_doc_hierarchy_level(doc, is_update):
"""Assert hierarchy level information."""
tu.assert_object(doc.hierarchy_level, cim.v1.DataHierarchyLevel)
h = doc.hierarchy_level
tu.assert_bool(h.is_open, True)
tu.assert_str(h.name, "experiment")
tu.assert_str(h.value, "HADGEM2_20C3M_1_D0_hus700")
示例7: _assert_doc_core
def _assert_doc_core(doc, is_update):
"""Assert core information."""
tu.assert_str(doc.description, "AMIP (1979 - at least 2008)", True)
tu.assert_str(doc.experiment_id, "3.3")
tu.assert_str(doc.long_name, "AMIP")
tu.assert_iter(doc.rationales, 1, str)
tu.assert_str(doc.rationales[0], "AMIP. Baseline simulation for", True)
tu.assert_str(doc.short_name, "amip")
示例8: _assert_doc_tile_zcoords
def _assert_doc_tile_zcoords(doc, is_update):
"""Assert tile zcoords information."""
t = doc.esm_model_grids[0].tiles[0]
tu.assert_object(t.zcoords, cim.v1.VerticalCoordinateList)
z = t.zcoords
tu.assert_str(z.form, "hybrid height")
tu.assert_str(z.type, "hybrid")
tu.assert_iter(z.properties, 1, cim.v1.GridProperty)
示例9: _test
def _test(mod):
"""Performs standard document extensions tests,"""
doc = tu.get_doc(mod) # Note - returns an extended document
tu.assert_object(doc.ext)
tu.assert_str(doc.type_key, doc.meta.type)
tu.assert_str(doc.type_key, doc.ext.type)
if hasattr(mod, "assert_doc_extensions"):
mod.assert_doc_extensions(doc)
示例10: _assert_doc_core
def _assert_doc_core(doc, is_update):
"""Assert core information."""
tu.assert_iter(doc.reports, 1)
r = doc.reports[0]
tu.assert_date(r.date, '2011-05-01 12:00:00')
tu.assert_object(r.evaluator, cim.v1.ResponsibleParty)
tu.assert_str(r.evaluator.individual_name, '[email protected]')
tu.assert_str(r.evaluator.role, 'pointofContact')
示例11: _assert_doc_core
def _assert_doc_core(doc, is_update):
"""Assert core information."""
tu.assert_str(doc.long_name, "Machine IBM Power 6 and compiler Other")
tu.assert_str(doc.short_name, "IBM Power 6_Other")
tu.assert_iter(doc.contacts, 1, cim.v1.ResponsibleParty)
tu.assert_str(doc.contacts[0].abbreviation, "MOHC")
tu.assert_str(doc.contacts[0].organisation_name, "UK Met Office Hadley Centre")
tu.assert_str(doc.contacts[0].role, "contact")
tu.assert_iter(doc.units, 1, cim.v1.MachineCompilerUnit)
示例12: _assert_doc_tile_vertical_resolution
def _assert_doc_tile_vertical_resolution(doc, is_update):
"""Assert tile vertical resolution."""
t = doc.esm_model_grids[0].tiles[0]
tu.assert_object(t.vertical_resolution, cim.v1.GridTileResolutionType)
vr = t.vertical_resolution
tu.assert_iter(vr.properties, 4, cim.v1.GridProperty)
p = vr.properties[0]
tu.assert_str(p.name, "TopModelLevel")
tu.assert_str(p.value, "39254.8")
示例13: _assert_doc_core
def _assert_doc_core(doc, is_update):
"""Assert core information."""
tu.assert_str(doc.acronym, "fossil_fuel_organic_carbon")
tu.assert_str(doc.data_status, "complete")
tu.assert_str(doc.description, "2D gridded monthly-mean", True)
tu.assert_iter(doc.storage, 1)
storage = doc.storage[0]
tu.assert_object(storage, cim.v1.DataStorageIp)
tu.assert_str(storage.format, "ASCII")
tu.assert_str(storage.file_name, "emissions of organic", True)
示例14: _assert_doc
def _assert_doc(doc, typeof=None):
"""Perform standard test document assertions."""
tu.assert_object(doc, typeof)
if hasattr(doc, "meta"):
tu.assert_str(doc.meta.institute, _INSTITUTE.lower())
tu.assert_str(doc.meta.language, pyesdoc.ESDOC_DEFAULT_LANGUAGE)
tu.assert_str(doc.meta.project, _PROJECT.lower())
tu.assert_str(doc.meta.source, _INSTITUTE.lower())
if typeof is not None:
tu.assert_str(doc.meta.type, typeof.type_key)
示例15: _assert_doc_core
def _assert_doc_core(doc, is_update):
"""Assert core information."""
tu.assert_str(doc.description, "The HadGEM2-A model", True)
if not is_update:
tu.assert_str(doc.long_name, "Hadley Global Environment Model 2 - Atmosphere")
tu.assert_date(doc.release_date, "2009")
tu.assert_str(doc.short_name, "HadGEM2-A")
tu.assert_str(doc.type, "model")
tu.assert_int(doc.types, 2)
tu.assert_str(doc.types[1], "model")