-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
29 lines (22 loc) · 758 Bytes
/
test.py
File metadata and controls
29 lines (22 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from efemel.pipeline.pipeline import Pipeline
from efemel.pipeline.transformers.transformer import Transformer
def generate_test_data(size: int = 1_000_000) -> list[int]:
"""Generate test data of specified size."""
return range(size) # type: ignore
def run():
PIPELINE_TRANSFORMER = (
Transformer()
.filter(lambda x: x % 2 == 0) # Filter even numbers
.map(lambda x: x * 2) # Double them
.filter(lambda x: x > 100) # Filter > 100
.map(lambda x: x + 1)
)
for i in range(20):
Pipeline(generate_test_data(1_000_000)).apply(PIPELINE_TRANSFORMER).to_list()
print(f"Finished run {i + 1}")
if __name__ == "__main__":
try:
run()
except Exception as e:
print(f"\n❌ Test failed with error: {e}")
raise