Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_init_fields_name_test():
"""
test if the field's names of the dispatch_rule identifier tuple are
correctly initialized
"""
assert HWPCDispatchRule(HWPCDepthLevel.TARGET).fields == ['target']
assert HWPCDispatchRule(HWPCDepthLevel.ROOT).fields == ['sensor']
assert HWPCDispatchRule(HWPCDepthLevel.SOCKET).fields == ['sensor',
'socket']
assert HWPCDispatchRule(HWPCDepthLevel.CORE).fields == ['sensor', 'socket',
'core']
def test_init_fields_name_test():
"""
test if the field's names of the dispatch_rule identifier tuple are
correctly initialized
"""
assert HWPCDispatchRule(HWPCDepthLevel.TARGET).fields == ['target']
assert HWPCDispatchRule(HWPCDepthLevel.ROOT).fields == ['sensor']
assert HWPCDispatchRule(HWPCDepthLevel.SOCKET).fields == ['sensor',
'socket']
assert HWPCDispatchRule(HWPCDepthLevel.CORE).fields == ['sensor', 'socket',
'core']
def test_init_fields_name_test():
"""
test if the field's names of the dispatch_rule identifier tuple are
correctly initialized
"""
assert HWPCDispatchRule(HWPCDepthLevel.TARGET).fields == ['target']
assert HWPCDispatchRule(HWPCDepthLevel.ROOT).fields == ['sensor']
assert HWPCDispatchRule(HWPCDepthLevel.SOCKET).fields == ['sensor',
'socket']
assert HWPCDispatchRule(HWPCDepthLevel.CORE).fields == ['sensor', 'socket',
'core']
def route_table_hwpc_not_primary():
"""
return a RouteTable with :
- a FakeGBR as primary rule
- a HWPCGrouptBy rule
"""
route_table = RouteTable()
route_table.dispatch_rule(FakeReport, FakeGBR(primary=True))
route_table.dispatch_rule(HWPCReport, HWPCDispatchRule(HWPCDepthLevel.ROOT))
return route_table
def test_get_formula_id_target_rule(report):
"""
get formula id from reports with a rule that dispatch by target :
the method must return this list :
[('system',)]
"""
ids = HWPCDispatchRule(HWPCDepthLevel.TARGET).get_formula_id(report)
validate_formula_id(ids, [('system',)])
def test_get_formula_id_cpu_rule_report_3(report_3):
"""
get formula id from report3 with a rule that dispatch by cpu :
the method must return this list :
[('toto','1', '1'), ('toto','1', '2'), ('toto','2', '3'), ('toto','2', '3')]
"""
ids = HWPCDispatchRule(HWPCDepthLevel.CORE).get_formula_id(report_3)
validate_formula_id(ids, [('toto', '1', '1'), ('toto', '1', '2'),
('toto', '2', '3'), ('toto', '2', '4')])
def test_get_formula_id_sensor_rule(report):
"""
get formula id from reports with a rule that dispatch by sensor :
the method must return this list :
[('toto',)]
"""
ids = HWPCDispatchRule(HWPCDepthLevel.ROOT).get_formula_id(report)
validate_formula_id(ids, [('toto',)])