item() equal to 0 raises StateIterationItemNotSetError (falsy item treated as unset)
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 88/100
Línea de trabajo
Comienza en src/data_factory_testing_framework/_pythonnet/data_factory_testing_framework_expressions_evaluator.py#L53 y ejecuta después la reproducción proporcionada de @range(0, 3). Se considera terminado cuando ForEach produce los resultados de Append_Item 0, 1 y 2, mientras que los elementos de iteración no establecidos siguen generando StateIterationItemNotSetError; comprueba las demás pruebas de truthiness de iteration_item indicadas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Inside a ForEach, an item() whose value is 0 raises StateIterationItemNotSetError, as if no item were set. @range(0, n) therefore fails on its first iteration.
Environment: data-factory-testing-framework 1.4.2 (also present on main at 11b9f27), Python 3.12.13, .NET 10.0.12, Linux.
Repro
import json, tempfile
from pathlib import Path
from data_factory_testing_framework import TestFramework, TestFrameworkType
pipeline = {
"name": "item_zero",
"properties": {
"variables": {"items": {"type": "Array"}},
"activities": [
{
"name": "Each_Day",
"type": "ForEach",
"dependsOn": [],
"typeProperties": {
"items": {"value": "@range(0, 3)", "type": "Expression"},
"activities": [
{
"name": "Append_Item",
"type": "AppendVariable",
"dependsOn": [],
"typeProperties": {
"variableName": "items",
"value": {"value": "@item()", "type": "Expression"},
},
}
],
},
}
],
},
}
root = Path(tempfile.mkdtemp())
(root / "pipeline").mkdir()
(root / "pipeline" / "item_zero.json").write_text(json.dumps(pipeline))
framework = TestFramework(framework_type=TestFrameworkType.DataFactory, root_folder_path=str(root))
for activity in framework.evaluate_pipeline(framework.get_pipeline_by_name("item_zero"), []):
print(activity.name, activity.type_properties["value"].result) # expected: 0, 1, 2
Expected: Append_Item 0, Append_Item 1, Append_Item 2.
Actual:
StateIterationItemNotSetError: Iteration item not set.
Cause
data_factory_testing_framework_expressions_evaluator.py#L53 tests the item for truthiness:
state_iter_item_json = json.dumps(state.iteration_item) if state.iteration_item else None
so any falsy item (0, and by the same line "", false, [], {}) is sent to the evaluator as "no item". Verified with 0.
Suggested fix: if state.iteration_item is not None else None. The same check probably matters wherever iteration_item is tested for truthiness.
- Lenguaje dominante
- Python
- Estrellas
- 135
- Forks
- 44
- Merge medio
- 6 d 20 h
- PR fusionados (30 d)
- 2
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/data-factory-testing-framework
-
A new ExpressionRuntime (Lark grammar compile) per evaluated expression makes evaluation ~5x slowerPosiblemente ocupada @florian-burelli la tomó hace 28 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
-
IfCondition evaluates the expressions of the branch not taken (case-sensitive "activities" check)Posiblemente ocupada @florian-burelli la tomó hace 28 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
-
DataFactoryTestingFrameworkExpressionsEvaluator adds status property even if None is set.Posiblemente ocupada @LeonardHd la tomó hace 463 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Todos los issues de microsoft/data-factory-testing-framework
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
huggingface/deep-rl-class#723 ·
-
[tool] bug: Qwen3 XML tool parser raises on `...` argument values (Ellipsis is not JSON serializable)Posiblemente ocupada @super-yuki la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 87/100
verl-project/verl#8559 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
TencentCloud/octop-harness#228 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
google/osv-scalibr#2585 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
NousResearch/hermes-agent#149323 ·
Los mantenedores suelen responder en 1 día