use depyler_core::transpile_python_to_rust;
#[test]
#[ignore = "DEPYLER-STDLIB-OPERATOR: Not implemented yet - RED phase"]
fn test_attrgetter() {
let python = r#"
import operator
def get_name_attr(obj) -> str:
getter = operator.attrgetter('name')
return getter(obj)
"#;
let result = transpile_python_to_rust(python).expect("Transpilation failed");
assert!(result.contains("name") || result.contains("get"));
}
#[test]
#[ignore = "DEPYLER-STDLIB-OPERATOR: Not implemented yet - RED phase"]
fn test_itemgetter() {
let python = r#"
import operator
def get_first_item(obj) -> object:
getter = operator.itemgetter(0)
return getter(obj)
"#;
let result = transpile_python_to_rust(python).expect("Transpilation failed");
assert!(result.contains("get") || result.contains("[0]"));
}
#[test]
#[ignore = "DEPYLER-STDLIB-OPERATOR: Not implemented yet - RED phase"]
fn test_methodcaller() {
let python = r#"
import operator
def call_upper(obj) -> str:
caller = operator.methodcaller('upper')
return caller(obj)
"#;
let result = transpile_python_to_rust(python).expect("Transpilation failed");
assert!(result.contains("upper") || result.contains("to_uppercase"));
}