Exemplo n.º 1
0
 def test_size_missing_value(self):
     expr = create_expression.create_expression_from_prensor(
         prensor_test_util.create_big_prensor())
     new_root = size.size(expr, path.Path(["doc", "keep_me"]), "result")
     new_field = new_root.get_descendant_or_error(
         path.Path(["doc", "result"]))
     leaf_node = expression_test_util.calculate_value_slowly(new_field)
     self.assertAllEqual(leaf_node.parent_index, [0, 1, 2])
     self.assertAllEqual(leaf_node.values, [1, 1, 0])
Exemplo n.º 2
0
 def test_size(self):
   with self.session(use_gpu=False) as sess:
     expr = create_expression.create_expression_from_prensor(
         prensor_test_util.create_big_prensor())
     new_root = size.size(expr, path.Path(["doc", "bar"]), "result")
     new_field = new_root.get_descendant_or_error(path.Path(["doc", "result"]))
     leaf_node = expression_test_util.calculate_value_slowly(new_field)
     [parent_index,
      values] = sess.run([leaf_node.parent_index, leaf_node.values])
     self.assertAllEqual(parent_index, [0, 1, 2])
     self.assertAllEqual(values, [1, 2, 1])