File tree Expand file tree Collapse file tree
src/murfey/client/contexts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ def _number_from_name(name: str) -> int:
5656 """
5757 return (
5858 int (match .group (1 ))
59- if (match := re .search (r"\(([ \d+] )\)" , name )) is not None
59+ if (match := re .search (r"^[\w\s]+\(( \d+)\)$ " , name )) is not None
6060 else 1
6161 )
6262
Original file line number Diff line number Diff line change 66import pytest
77from pytest_mock import MockerFixture
88
9- from murfey .client .contexts .fib import FIBContext
9+ from murfey .client .contexts .fib import FIBContext , _number_from_name
1010
1111# -------------------------------------------------------------------------------------
1212# FIBContext test utilty functions and fixtures
@@ -193,6 +193,34 @@ def fib_maps_images(tmp_path: Path):
193193# -------------------------------------------------------------------------------------
194194# Tests
195195# -------------------------------------------------------------------------------------
196+
197+
198+ @pytest .mark .parametrize (
199+ "test_params" ,
200+ ( # File name | Expected number
201+ # AutoTEM examples
202+ ("Lamella" , 1 ),
203+ ("Lamella (2)" , 2 ),
204+ ("Lamella (12)" , 12 ),
205+ # Maps examples
206+ ("Electron Snapshot" , 1 ),
207+ ("Electron Snapshot (3)" , 3 ),
208+ ("Electron Snapshot (21)" , 21 ),
209+ ),
210+ )
211+ def test_number_from_name (test_params : tuple [str , int ]):
212+ name , number = test_params
213+ assert _number_from_name (name ) == number
214+
215+
216+ def test_get_source ():
217+ pass
218+
219+
220+ def test_file_transferred_to ():
221+ pass
222+
223+
196224def test_fib_autotem_context ():
197225 pass
198226
You can’t perform that action at this time.
0 commit comments