@@ -33,11 +33,10 @@ def test_complex_chain(self) -> None:
3333 source : Observable [int ] = rx .of (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 )
3434
3535 result : Observable [int ] = (
36- source
37- .filter (lambda x : x % 2 == 0 ) # [2, 4, 6, 8, 10]
38- .map (lambda x : x * 2 ) # [4, 8, 12, 16, 20]
39- .skip (1 ) # [8, 12, 16, 20]
40- .take (3 ) # [8, 12, 16]
36+ source .filter (lambda x : x % 2 == 0 ) # [2, 4, 6, 8, 10]
37+ .map (lambda x : x * 2 ) # [4, 8, 12, 16, 20]
38+ .skip (1 ) # [8, 12, 16, 20]
39+ .take (3 ) # [8, 12, 16]
4140 )
4241
4342 values : list [int ] = []
@@ -50,8 +49,7 @@ def test_chain_with_reduce(self) -> None:
5049 source : Observable [int ] = rx .of (1 , 2 , 3 , 4 , 5 )
5150
5251 result : Observable [int ] = (
53- source
54- .filter (lambda x : x > 2 )
52+ source .filter (lambda x : x > 2 )
5553 .map (lambda x : x * 2 )
5654 .reduce (lambda acc , x : acc + x , 0 )
5755 )
@@ -66,13 +64,9 @@ def test_mixed_fluent_and_pipe(self) -> None:
6664 source : Observable [int ] = rx .of (1 , 2 , 3 , 4 , 5 )
6765
6866 # Start with fluent, then use pipe
69- result : Observable [int ] = (
70- source
71- .map (lambda x : x * 2 )
72- .pipe (
73- ops .filter (lambda x : x > 5 ),
74- ops .take (2 ),
75- )
67+ result : Observable [int ] = source .map (lambda x : x * 2 ).pipe (
68+ ops .filter (lambda x : x > 5 ),
69+ ops .take (2 ),
7670 )
7771
7872 values : list [int ] = []
@@ -89,13 +83,12 @@ def test_transformation_filtering_mathematical(self) -> None:
8983 source : Observable [int ] = rx .of (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 )
9084
9185 result : Observable [float ] = (
92- source
93- .filter (lambda x : x % 2 == 0 ) # FilteringMixin: [2, 4, 6, 8, 10]
94- .take_while (lambda x : x < 9 ) # FilteringMixin: [2, 4, 6, 8]
95- .map (lambda x : x * 2 ) # TransformationMixin: [4, 8, 12, 16]
96- .distinct_until_changed () # FilteringMixin: [4, 8, 12, 16]
97- .start_with (0 ) # CombinationMixin: [0, 4, 8, 12, 16]
98- .average () # MathematicalMixin: [8.0]
86+ source .filter (lambda x : x % 2 == 0 ) # FilteringMixin: [2, 4, 6, 8, 10]
87+ .take_while (lambda x : x < 9 ) # FilteringMixin: [2, 4, 6, 8]
88+ .map (lambda x : x * 2 ) # TransformationMixin: [4, 8, 12, 16]
89+ .distinct_until_changed () # FilteringMixin: [4, 8, 12, 16]
90+ .start_with (0 ) # CombinationMixin: [0, 4, 8, 12, 16]
91+ .average () # MathematicalMixin: [8.0]
9992 )
10093
10194 values : list [float ] = []
@@ -108,11 +101,10 @@ def test_filtering_testing_chain(self) -> None:
108101 source : Observable [int ] = rx .of (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 )
109102
110103 result : Observable [bool ] = (
111- source
112- .skip_last (2 ) # FilteringMixin: [1, 2, 3, 4, 5, 6, 7, 8]
113- .take_last (6 ) # FilteringMixin: [3, 4, 5, 6, 7, 8]
114- .filter (lambda x : x % 2 == 0 ) # FilteringMixin: [4, 6, 8]
115- .all (lambda x : x > 3 ) # TestingMixin: Check if all > 3
104+ source .skip_last (2 ) # FilteringMixin: [1, 2, 3, 4, 5, 6, 7, 8]
105+ .take_last (6 ) # FilteringMixin: [3, 4, 5, 6, 7, 8]
106+ .filter (lambda x : x % 2 == 0 ) # FilteringMixin: [4, 6, 8]
107+ .all (lambda x : x > 3 ) # TestingMixin: Check if all > 3
116108 )
117109
118110 values : list [bool ] = []
@@ -131,12 +123,11 @@ def cleanup_action() -> None:
131123 action_called = True
132124
133125 result : Observable [list [int ]] = (
134- source
135- .do_action (side_effects .append ) # UtilityMixin
136- .filter (lambda x : x > 2 ) # FilteringMixin
137- .map (lambda x : x * 2 ) # TransformationMixin
138- .to_list () # UtilityMixin
139- .finally_action (cleanup_action ) # UtilityMixin
126+ source .do_action (side_effects .append ) # UtilityMixin
127+ .filter (lambda x : x > 2 ) # FilteringMixin
128+ .map (lambda x : x * 2 ) # TransformationMixin
129+ .to_list () # UtilityMixin
130+ .finally_action (cleanup_action ) # UtilityMixin
140131 )
141132
142133 values : list [list [int ]] = []
@@ -152,10 +143,9 @@ def test_combination_error_handling(self) -> None:
152143 fallback : Observable [int ] = rx .of (1 , 2 , 3 )
153144
154145 result : Observable [int ] = (
155- source
156- .catch (fallback ) # ErrorHandlingMixin
157- .start_with (0 ) # CombinationMixin
158- .take (3 ) # FilteringMixin
146+ source .catch (fallback ) # ErrorHandlingMixin
147+ .start_with (0 ) # CombinationMixin
148+ .take (3 ) # FilteringMixin
159149 )
160150
161151 values : list [int ] = []
@@ -170,11 +160,11 @@ def test_windowing_transformation_testing(self) -> None:
170160 # Test partition followed by operations on one partition
171161 evens , _odds = source .partition (lambda x : x % 2 == 0 )
172162
173- result : Observable [bool ] = (
174- evens
175- . map ( lambda x : x * 2 ) # TransformationMixin: [4, 8, 12]
176- . all ( lambda x : x % 4 == 0 ) # TestingMixin: Check divisible by 4
177- )
163+ result : Observable [bool ] = evens . map (
164+ lambda x : x * 2
165+ ). all ( # TransformationMixin: [4, 8, 12]
166+ lambda x : x % 4 == 0
167+ ) # TestingMixin: Check divisible by 4
178168
179169 values : list [bool ] = []
180170 result .subscribe (on_next = values .append )
@@ -190,8 +180,7 @@ def test_pipe_then_fluent(self) -> None:
190180 source : Observable [int ] = rx .of (1 , 2 , 3 , 4 , 5 )
191181
192182 result : Observable [int ] = (
193- source
194- .pipe (
183+ source .pipe (
195184 ops .filter (lambda x : x > 2 ),
196185 ops .map (lambda x : x * 2 ),
197186 )
@@ -209,8 +198,7 @@ def test_fluent_then_pipe_then_fluent(self) -> None:
209198 source : Observable [int ] = rx .of (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 )
210199
211200 result : Observable [int ] = (
212- source
213- .filter (lambda x : x > 2 )
201+ source .filter (lambda x : x > 2 )
214202 .pipe (
215203 ops .map (lambda x : x * 2 ),
216204 ops .take (3 ),
0 commit comments