File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -38,12 +38,12 @@ def get_visit_year(beamline, visit):
3838def get_xchem_subdirectory (visit ):
3939
4040 # This is the pattern all visits must have.
41- pattern = r"^([a-z][a-z][0-9][0-9][0-9][0-9][0-9])[-]([0-9]+)$"
41+ pattern = r"^([a-z][a-z][0-9][0-9][0-9][0-9][0-9])[-]([0-9]+)([_].*)? $"
4242
4343 match = re .search (pattern , visit )
4444
4545 if not match :
46- raise RuntimeError (
46+ raise ValueError (
4747 f'the visit name "{ visit } " does not conform to the visit naming convention'
4848 )
4949
Original file line number Diff line number Diff line change @@ -29,20 +29,28 @@ async def _main_coroutine(
2929 # Check valid visits.
3030 assert get_xchem_subdirectory ("aa12345-1" ) == "aa12345/aa12345-1"
3131 assert get_xchem_subdirectory ("aa12345-1234" ) == "aa12345/aa12345-1234"
32+ assert get_xchem_subdirectory ("aa12345-1234_" ) == "aa12345/aa12345-1234"
33+ assert (
34+ get_xchem_subdirectory ("aa12345-1234_some stuff" ) == "aa12345/aa12345-1234"
35+ )
3236
3337 # Check invalid visit formats.
34- with pytest .raises (RuntimeError ) as excinfo :
38+ with pytest .raises (ValueError ) as excinfo :
3539 get_xchem_subdirectory ("aa12345" )
3640 assert "convention" in str (excinfo .value )
3741
38- with pytest .raises (RuntimeError ) as excinfo :
42+ with pytest .raises (ValueError ) as excinfo :
3943 get_xchem_subdirectory ("a12345-1" )
4044 assert "convention" in str (excinfo .value )
4145
42- with pytest .raises (RuntimeError ) as excinfo :
46+ with pytest .raises (ValueError ) as excinfo :
4347 get_xchem_subdirectory ("[aa12345-1]" )
4448 assert "convention" in str (excinfo .value )
4549
50+ with pytest .raises (ValueError ) as excinfo :
51+ get_xchem_subdirectory ("aa12345-1-somestuff" )
52+ assert "convention" in str (excinfo .value )
53+
4654 # Check good directory.
4755 parent = Path (output_directory ) / "processing/lab36"
4856 full_path = parent / "aa12345/aa12345-1"
You can’t perform that action at this time.
0 commit comments