本文整理汇总了Python中apache.aurora.config.loader.AuroraConfigLoader.loads_json方法的典型用法代码示例。如果您正苦于以下问题:Python AuroraConfigLoader.loads_json方法的具体用法?Python AuroraConfigLoader.loads_json怎么用?Python AuroraConfigLoader.loads_json使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apache.aurora.config.loader.AuroraConfigLoader
的用法示例。
在下文中一共展示了AuroraConfigLoader.loads_json方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_filter_schema
# 需要导入模块: from apache.aurora.config.loader import AuroraConfigLoader [as 别名]
# 或者: from apache.aurora.config.loader.AuroraConfigLoader import loads_json [as 别名]
def test_filter_schema():
env = AuroraConfigLoader.load(BytesIO(MESOS_CONFIG))
job_dict = env['jobs'][0].get()
job_dict['unknown_attribute'] = 'foo bar baz'
job_json_string = json.dumps(job_dict)
with pytest.raises(AttributeError):
AuroraConfigLoader.loads_json(job_json_string)
示例2: test_filter_schema
# 需要导入模块: from apache.aurora.config.loader import AuroraConfigLoader [as 别名]
# 或者: from apache.aurora.config.loader.AuroraConfigLoader import loads_json [as 别名]
def test_filter_schema():
env = AuroraConfigLoader.load(BytesIO(MESOS_CONFIG))
job_dict = env['jobs'][0].get()
job_dict['unknown_attribute'] = 'foo bar baz'
job_json_string = json.dumps(job_dict)
# If this fails, will raise an InvalidConfigError or other exception and fail the test.
AuroraConfigLoader.loads_json(job_json_string)
示例3: test_load_json_multi
# 需要导入模块: from apache.aurora.config.loader import AuroraConfigLoader [as 别名]
# 或者: from apache.aurora.config.loader.AuroraConfigLoader import loads_json [as 别名]
def test_load_json_multi():
env = AuroraConfigLoader.load(BytesIO(MESOS_CONFIG_MULTI))
jobs = env['jobs']
json_env = AuroraConfigLoader.loads_json(json.dumps({'jobs': [job.get() for job in jobs]}))
json_jobs = json_env['jobs']
assert jobs == json_jobs
示例4: test_load_json_single
# 需要导入模块: from apache.aurora.config.loader import AuroraConfigLoader [as 别名]
# 或者: from apache.aurora.config.loader.AuroraConfigLoader import loads_json [as 别名]
def test_load_json_single():
env = AuroraConfigLoader.load(BytesIO(MESOS_CONFIG))
job = env['jobs'][0]
new_job = AuroraConfigLoader.loads_json(json.dumps(job.get()))['jobs'][0]
assert new_job == job