@@ -160,24 +160,73 @@ def get(self) -> Any | None:
160160@pytest .mark .parametrize (
161161 "event, expected_port_key" ,
162162 [
163- (FileCreatedEvent (src_path = f"{ _STATE_PATH } /untitled.txt" , dest_path = "" ), None ),
164- (DirModifiedEvent (src_path = f"{ _STATE_PATH } " , dest_path = "" ), None ),
165- (FileClosedEvent (src_path = f"{ _STATE_PATH } /untitled.txt" , dest_path = "" ), None ),
166- (
163+ pytest .param (
164+ FileCreatedEvent (src_path = f"{ _STATE_PATH } /untitled.txt" , dest_path = "" ),
165+ None ,
166+ id = "file_create_outside" ,
167+ ),
168+ pytest .param (
169+ FileCreatedEvent (
170+ src_path = f"{ _STATE_PATH } /output_1/untitled1.txt" ,
171+ dest_path = "" ,
172+ ),
173+ "output_1" ,
174+ id = "file_create_inside_monitored_port" ,
175+ ),
176+ pytest .param (
177+ FileCreatedEvent (
178+ src_path = f"{ _STATE_PATH } /output_9/untitled1.txt" ,
179+ dest_path = "" ,
180+ ),
181+ None ,
182+ id = "file_create_inside_not_monitored_port" ,
183+ ),
184+ pytest .param (
167185 FileMovedEvent (
168186 src_path = f"{ _STATE_PATH } /untitled.txt" ,
169187 dest_path = f"{ _STATE_PATH } /asdsadsasad.txt" ,
170188 ),
171189 None ,
190+ id = "move_outside_any_port" ,
172191 ),
173- (
192+ pytest . param (
174193 FileMovedEvent (
175194 src_path = f"{ _STATE_PATH } /asdsadsasad.txt" ,
176195 dest_path = f"{ _STATE_PATH } /output_1/asdsadsasad.txt" ,
177196 ),
178197 "output_1" ,
198+ id = "move_to_monitored_port" ,
199+ ),
200+ pytest .param (
201+ FileMovedEvent (
202+ src_path = f"{ _STATE_PATH } /asdsadsasad.txt" ,
203+ dest_path = f"{ _STATE_PATH } /output_9/asdsadsasad.txt" ,
204+ ),
205+ None ,
206+ id = "move_outside_monitored_port" ,
207+ ),
208+ pytest .param (
209+ DirModifiedEvent (src_path = f"{ _STATE_PATH } /output_1" , dest_path = "" ),
210+ None ,
211+ id = "modified_port_dir_does_nothing" ,
212+ ),
213+ pytest .param (
214+ DirModifiedEvent (src_path = f"{ _STATE_PATH } " , dest_path = "" ),
215+ None ,
216+ id = "modified_outer_dir_does_nothing" ,
217+ ),
218+ pytest .param (
219+ FileClosedEvent (src_path = f"{ _STATE_PATH } /untitled.txt" , dest_path = "" ),
220+ None ,
221+ id = "close_file_outside_does_nothing" ,
222+ ),
223+ pytest .param (
224+ FileClosedEvent (
225+ src_path = f"{ _STATE_PATH } /output_1/asdsadsasad.txt" , dest_path = ""
226+ ),
227+ "output_1" ,
228+ id = "close_file_inside_triggers_event" ,
179229 ),
180- (DirModifiedEvent (src_path = f"{ _STATE_PATH } /output_1" , dest_path = "" ), None ),
181230 ],
182231)
183232def test_port_keys_event_handler_triggers_for_events (
0 commit comments