本文整理汇总了Python中autoprotocol.harness.ProtocolInfo.parse方法的典型用法代码示例。如果您正苦于以下问题:Python ProtocolInfo.parse方法的具体用法?Python ProtocolInfo.parse怎么用?Python ProtocolInfo.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类autoprotocol.harness.ProtocolInfo
的用法示例。
在下文中一共展示了ProtocolInfo.parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_group_default
# 需要导入模块: from autoprotocol.harness import ProtocolInfo [as 别名]
# 或者: from autoprotocol.harness.ProtocolInfo import parse [as 别名]
def test_group_default(self):
protocol_info = ProtocolInfo({
'name': 'Test Basic Blank Defaults',
'inputs': {
'group': {
'type': 'group',
'inputs': {
'bool': 'bool',
'aliquot': 'aliquot',
'aliquot+': 'aliquot+'
}
},
'group+': {
'type': 'group+',
'inputs': {
'bool': 'bool'
}
}
}
})
parsed = protocol_info.parse(self.protocol, {
'refs': {},
'parameters': {}
})
assert isinstance(parsed['group'], dict)
assert (parsed['group']['bool'] is None)
assert (parsed['group']['aliquot'] is None)
assert isinstance(parsed['group']['aliquot+'], WellGroup)
assert (0 == len(parsed['group']['aliquot+']))
assert ([{'bool': None}] == parsed['group+'])
示例2: test_multigroup
# 需要导入模块: from autoprotocol.harness import ProtocolInfo [as 别名]
# 或者: from autoprotocol.harness.ProtocolInfo import parse [as 别名]
def test_multigroup(self):
protocol_info = ProtocolInfo({
'name': 'Test Basic Types',
'inputs': {
'group_test': {
'type': 'group+',
'inputs': {
'test': 'aliquot'
}
}
}
})
parsed = protocol_info.parse(self.protocol, {
'refs': {
'ct1test': {'id': 'ct1test', 'type': '96-pcr', 'discard': True}
},
'parameters': {
'group_test': [
{'test': 'ct1test/0'},
{'test': 'ct1test/1'}
]
}
})
self.assertTrue(isinstance(parsed['group_test'], list))
self.assertEqual(2, len(parsed['group_test']))
self.assertTrue('test' in parsed['group_test'][0])
self.assertTrue(isinstance(parsed['group_test'][0]['test'], Well))
self.assertTrue('test' in parsed['group_test'][1])
self.assertTrue(isinstance(parsed['group_test'][1]['test'], Well))
self.assertEqual(1, parsed['group_test'][1]['test'].index)
示例3: test_basic_types
# 需要导入模块: from autoprotocol.harness import ProtocolInfo [as 别名]
# 或者: from autoprotocol.harness.ProtocolInfo import parse [as 别名]
def test_basic_types(self):
protocol_info = ProtocolInfo({
'name': 'Test Basic Types',
'inputs': {
'bool': 'bool',
'string': 'string',
'integer': 'integer',
'decimal': 'decimal'
}
})
parsed = protocol_info.parse(self.protocol, {
'refs': {},
'parameters': {
'bool': True,
'string': 'test',
'integer': 3,
'decimal': 2.1
}
})
self.assertEqual({
'bool': True,
'string': 'test',
'integer': 3,
'decimal': 2.1
}, parsed)
示例4: test_group_default
# 需要导入模块: from autoprotocol.harness import ProtocolInfo [as 别名]
# 或者: from autoprotocol.harness.ProtocolInfo import parse [as 别名]
def test_group_default(self):
protocol_info = ProtocolInfo({
'name': 'Test Basic Blank Defaults',
'inputs': {
'group': {
'type': 'group',
'inputs': {
'bool': 'bool',
'aliquot': 'aliquot',
'aliquot+': 'aliquot+'
}
},
'group+': {
'type': 'group+',
'inputs': {
'bool': 'bool'
}
}
}
})
parsed = protocol_info.parse(self.protocol, {
'refs': {},
'parameters': {}
})
self.assertIsInstance(parsed['group'], dict)
self.assertIsNone(parsed['group']['bool'])
self.assertIsNone(parsed['group']['aliquot'])
self.assertIsInstance(parsed['group']['aliquot+'], WellGroup)
self.assertEqual(0, len(parsed['group']['aliquot+']))
self.assertEqual([{'bool': None}], parsed['group+'])
示例5: test_group
# 需要导入模块: from autoprotocol.harness import ProtocolInfo [as 别名]
# 或者: from autoprotocol.harness.ProtocolInfo import parse [as 别名]
def test_group(self):
protocol_info = ProtocolInfo({
'name': 'Test Basic Types',
'inputs': {
'group_test': {
'type': 'group',
'inputs': {
'test': 'aliquot'
}
}
}
})
parsed = protocol_info.parse(self.protocol, {
'refs': {
'ct1test': {'id': 'ct1test', 'type': '96-pcr', 'discard': True}
},
'parameters': {
'group_test': {
'test': 'ct1test/0'
}
}
})
self.assertTrue(isinstance(parsed['group_test'], dict))
self.assertTrue('test' in parsed['group_test'])
self.assertTrue(isinstance(parsed['group_test']['test'], Well))
示例6: test_unit_types
# 需要导入模块: from autoprotocol.harness import ProtocolInfo [as 别名]
# 或者: from autoprotocol.harness.ProtocolInfo import parse [as 别名]
def test_unit_types(self):
protocol_info = ProtocolInfo({
'name': 'Test Basic Types',
'inputs': {
'volume': 'volume',
'time': 'time',
'temperature': 'temperature'
}
})
parsed = protocol_info.parse(self.protocol, {
'refs': {},
'parameters': {
'volume': '3:microliter',
'time': '30:second',
'temperature': '25:celsius'
}
})
self.assertEqual({
'volume': Unit.fromstring('3:microliter'),
'time': Unit.fromstring('30:second'),
'temperature': Unit.fromstring('25:celsius')
}, parsed)
with self.assertRaises(RuntimeError):
parsed = protocol_info.parse(self.protocol, {
'refs': {},
'parameters': {
'volume': 3,
'time': '30:second',
'temperature': '25:celsius'
}
})
parsed = protocol_info.parse(self.protocol, {
'refs': {},
'parameters': {
'volume': "3:microliter",
'time': "hello",
'temperature': '25:celsius'
}
})
parsed = protocol_info.parse(self.protocol, {
'refs': {},
'parameters': {
'volume': "3:microliter",
'time': "30:second",
'temperature': 25
}
})
示例7: test_basic_types
# 需要导入模块: from autoprotocol.harness import ProtocolInfo [as 别名]
# 或者: from autoprotocol.harness.ProtocolInfo import parse [as 别名]
def test_basic_types(self):
protocol_info = ProtocolInfo({
'name': 'Test Basic Types',
'inputs': {
'bool': 'bool',
'string': 'string',
'integer': 'integer',
'decimal': 'decimal'
}
})
parsed = protocol_info.parse(self.protocol, {
'refs': {},
'parameters': {
'bool': True,
'string': 'test',
'integer': 3,
'decimal': 2.1
}
})
assert ({
'bool': True,
'string': 'test',
'integer': 3,
'decimal': 2.1
} == parsed)
with pytest.raises(RuntimeError):
parsed = protocol_info.parse(self.protocol, {
'refs': {},
'parameters': {
'bool': True,
'string': 'test',
'integer': "hi",
'decimal': 2.1
}
})
with pytest.raises(RuntimeError):
parsed = protocol_info.parse(self.protocol, {
'refs': {},
'parameters': {
'bool': True,
'string': 'test',
'integer': "3",
'decimal': "hi"
}
})
示例8: test_empty
# 需要导入模块: from autoprotocol.harness import ProtocolInfo [as 别名]
# 或者: from autoprotocol.harness.ProtocolInfo import parse [as 别名]
def test_empty(self):
protocol_info = ProtocolInfo({
'name': 'Test Empty',
'inputs': {}
})
parsed = protocol_info.parse(self.protocol, {
'refs': {},
'parameters': {}
})
self.assertEqual({}, parsed)
示例9: test_container_errors
# 需要导入模块: from autoprotocol.harness import ProtocolInfo [as 别名]
# 或者: from autoprotocol.harness.ProtocolInfo import parse [as 别名]
def test_container_errors(self):
with self.assertRaises(RuntimeError):
protocol_info1 = ProtocolInfo({
'name': 'Test Errors',
'inputs': {
'cont': {
'type': 'container'
}
}})
parsed1 = protocol_info1.parse(self.protocol, {
'refs': {
"my_cont":{
"type": "micro-1.5",
"discard": True
}
},
'parameters': {
"cont": "my_cont/0"
}
})
parsed2 = protocol_info1.parse(self.protocol, {
'refs': {
"my_cont":{
"type": "micro-1.5",
"discard": True
}
},
'parameters': {
"cont": "another_cont"
}
})
parsed3 = protocol_info1.parse(self.protocol, {
'refs': {
"my_cont":{
"type": "micro-1.5",
"discard": True
}
},
'parameters': {
"cont": 12
}
})
示例10: test_container_volumes
# 需要导入模块: from autoprotocol.harness import ProtocolInfo [as 别名]
# 或者: from autoprotocol.harness.ProtocolInfo import parse [as 别名]
def test_container_volumes(self):
protocol_info1 = ProtocolInfo({
'name': 'Test Container Volumes',
'inputs': {
'cont': {
'type': 'container'
}
}
})
parsed = protocol_info1.parse(self.protocol, {
"refs": {
"echo_plate": {
"type": "384-echo",
"discard": True,
"aliquots": {
"0": {"volume": "135:microliter"}
}
}
},
"parameters": {
"cont": "echo_plate"
}
})
assert parsed["cont"].well(0).volume == Unit(135, "microliter")
with pytest.raises(ValueError) as e:
protocol_info1.parse(self.protocol, {
'refs': {
"my_cont": {
"type": "384-echo",
"discard": True,
"aliquots": {
"0": {"volume": "10000:microliter"}
}
}
},
'parameters': {
"cont": "my_cont"
}
})
assert "Theoretical volume" in str(e.value)
示例11: test_basic_types
# 需要导入模块: from autoprotocol.harness import ProtocolInfo [as 别名]
# 或者: from autoprotocol.harness.ProtocolInfo import parse [as 别名]
def test_basic_types(self):
protocol_info = ProtocolInfo(
{
"name": "Test Basic Types",
"inputs": {"bool": "bool", "string": "string", "integer": "integer", "decimal": "decimal"},
}
)
parsed = protocol_info.parse(
self.protocol, {"refs": {}, "parameters": {"bool": True, "string": "test", "integer": 3, "decimal": 2.1}}
)
self.assertEqual({"bool": True, "string": "test", "integer": 3, "decimal": 2.1}, parsed)
示例12: test_csv_table
# 需要导入模块: from autoprotocol.harness import ProtocolInfo [as 别名]
# 或者: from autoprotocol.harness.ProtocolInfo import parse [as 别名]
def test_csv_table(self):
protocol_info = ProtocolInfo({
'name': 'Test Basic Types',
'inputs': {
"table_test": {
"template": {
"header": ["Destination Well", "Source Well", "Final concentration in ug/ml"],
"keys": ["dest_well", "source_well", "final_concentration_ugml"],
"col_type": ["integer", "aliquot", "decimal"],
"rows": [
["0", "ct17652537/0", "1.2"],
["1", "ct17652537/0", "4.37"]
],
"label": "Test Table CSV"
},
"type": "csv-table",
"label": "test table label"
}
}
})
parsed = protocol_info.parse(self.protocol, {
'refs': {
'ct1test': {'id': 'ct1test', 'type': 'micro-1.5', 'discard': True},
'ct2test': {'id': 'ct2test', 'type': 'micro-1.5', 'discard': True}
},
'parameters': {
"table_test": [
{
"dest_well": "integer",
"source_well": "aliquot",
"final_concentration_ugml": "decimal"
},
[
{
"dest_well": 0,
"source_well": "ct1test/0",
"final_concentration_ugml": 0.5
},
{
"dest_well": 1,
"source_well": "ct2test/0",
"final_concentration_ugml": 0.6
}
]
]
}
})
self.assertTrue(isinstance(parsed['table_test'], list))
self.assertTrue(isinstance(parsed['table_test'][0], dict))
self.assertTrue('final_concentration_ugml' in parsed['table_test'][0])
self.assertTrue(isinstance(parsed['table_test'][1]['source_well'], Well))
示例13: test_group
# 需要导入模块: from autoprotocol.harness import ProtocolInfo [as 别名]
# 或者: from autoprotocol.harness.ProtocolInfo import parse [as 别名]
def test_group(self):
protocol_info = ProtocolInfo(
{"name": "Test Basic Types", "inputs": {"group_test": {"type": "group", "inputs": {"test": "aliquot"}}}}
)
parsed = protocol_info.parse(
self.protocol,
{
"refs": {"ct1test": {"id": "ct1test", "type": "96-pcr", "discard": True}},
"parameters": {"group_test": {"test": "ct1test/0"}},
},
)
self.assertTrue(isinstance(parsed["group_test"], dict))
self.assertTrue("test" in parsed["group_test"])
self.assertTrue(isinstance(parsed["group_test"]["test"], Well))
示例14: test_unit_types
# 需要导入模块: from autoprotocol.harness import ProtocolInfo [as 别名]
# 或者: from autoprotocol.harness.ProtocolInfo import parse [as 别名]
def test_unit_types(self):
protocol_info = ProtocolInfo(
{"name": "Test Basic Types", "inputs": {"volume": "volume", "time": "time", "temperature": "temperature"}}
)
parsed = protocol_info.parse(
self.protocol,
{"refs": {}, "parameters": {"volume": "3:microliter", "time": "30:second", "temperature": "25:celsius"}},
)
self.assertEqual(
{
"volume": Unit.fromstring("3:microliter"),
"time": Unit.fromstring("30:second"),
"temperature": Unit.fromstring("25:celsius"),
},
parsed,
)
示例15: test_ref_default
# 需要导入模块: from autoprotocol.harness import ProtocolInfo [as 别名]
# 或者: from autoprotocol.harness.ProtocolInfo import parse [as 别名]
def test_ref_default(self):
protocol_info = ProtocolInfo(
{
"name": "Test Basic Blank Defaults",
"inputs": {
"aliquot": "aliquot",
"aliquot+": "aliquot+",
"aliquot++": "aliquot++",
"container": "container",
},
}
)
parsed = protocol_info.parse(self.protocol, {"refs": {}, "parameters": {}})
self.assertIsNone(parsed["aliquot"])
self.assertIsNone(parsed["container"])
self.assertIsInstance(parsed["aliquot+"], WellGroup)
self.assertEqual(0, len(parsed["aliquot+"]))
self.assertEqual([], parsed["aliquot++"])