def does_node_pass(input_node, analysis): """ Evaluates the PASS/FAIL status of a QC node. Args: node (list): An s-expression list in the form of [operator, arg1, arg2, ...]. analysis (dict): A dictionary containing to the variables referenced in the given QC node Yields: True if the node passes QC, False if it fails QC. """ return node.eval(node.eval_variables(analysis, input_node))
def test_eval_less_than_with_two_literals(): n = ['less_than', 2, 1] assert_false(node.eval(n))
def test_eval_greater_than_with_two_literals(): n = ['greater_than', 2, 1] assert_true(node.eval(n))
def test_eval_with_doc_string(): n = [{'name': 'my threshold'}, 'greater_than', 2, 1] assert_true(node.eval(n))
def test_eval_with_is_not_in(): n = ['is_not_in', 2, ['list', 2, 1]] assert_false(node.eval(n))
def test_eval_with_in(): n = ['is_in', 2, ['list', 2, 1]] assert_true(node.eval(n))
def test_eval_with_list(): n = ['list', 2, 1] assert_equal([2, 1], node.eval(n))
def test_eval_false_with_nested_lists(): n = ['and', ['greater_than', 1, 2],['greater_than', 1, 2]] assert_false(node.eval(n))
def test_eval_true_with_nested_lists(): n = ['and', ['greater_than', 2, 1],['greater_than', 2, 1]] assert_true(node.eval(n))