def test_adds_all_nodes_to_set_with_constant_true_predicate(self): nested_tree = test_utils.create_nested_syntax_tree() all_nodes = tree_analysis.extract_nodes_consuming( nested_tree, lambda x: True) node_count = tree_analysis.count(nested_tree) self.assertLen(all_nodes, node_count)
def test_adds_no_nodes_to_set_with_constant_false_predicate(self): nested_tree = test_utils.create_nested_syntax_tree() all_nodes = tree_analysis.extract_nodes_consuming( nested_tree, lambda x: False) self.assertEmpty(all_nodes)
def test_returns_zero_no_tensorflow(self): no_tensorflow_comp = test_utils.create_nested_syntax_tree() variable_count = tree_analysis.count_tensorflow_variables_under( no_tensorflow_comp) self.assertEqual(variable_count, 0)