MCPcopy Create free account
hub / github.com/YuminosukeSato/ironkernel / execute_map_name_based

Function execute_map_name_based

src/python/py_kernel.rs:474–503  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

472
473 #[test]
474 fn execute_map_name_based() {
475 let km = PyKernelModule::new();
476 let x = km.arg("x");
477 let y = km.arg("y");
478 // x + y
479 let expr = PyExpr::binop_with_temp_args(
480 BinaryOp::Add,
481 &x.inner,
482 &y.inner,
483 &x.temp_args,
484 &y.temp_args,
485 );
486 let spec = km.elementwise(expr).unwrap();
487
488 // Create MapSpec manually with named args
489 let mut args = HashMap::new();
490 args.insert(
491 "x".to_string(),
492 ArgValue::Buffer(Buffer::from_f64_vec(vec![1.0, 2.0, 3.0])),
493 );
494 args.insert(
495 "y".to_string(),
496 ArgValue::Buffer(Buffer::from_f64_vec(vec![10.0, 20.0, 30.0])),
497 );
498 let map_spec = PyMapSpec { spec, args };
499
500 let result = execute_map(&map_spec).unwrap();
501 let data = result.as_f64_slice();
502 assert_eq!(data, &[11.0, 22.0, 33.0]);
503 }
504
505 #[test]
506 fn execute_map_missing_arg() {

Callers

nothing calls this directly

Calls 5

BufferClass · 0.85
execute_mapFunction · 0.85
as_f64_sliceMethod · 0.80
argMethod · 0.45
elementwiseMethod · 0.45

Tested by

no test coverage detected