4
4
import random
5
5
import string
6
6
import datetime
7
- import numpy as np
8
7
8
+ import numpy as np
9
9
import requests
10
10
from one .api import ONE
11
+ from one .registration import RegistrationClient
11
12
12
13
from ibllib .tests import TEST_DB
13
14
import ibllib .qc .critical_reasons as usrpmt
14
- from one .registration import RegistrationClient
15
15
16
16
one = ONE (** TEST_DB )
17
17
@@ -33,7 +33,6 @@ def setUp(self) -> None:
33
33
one .alyx .clear_rest_cache ()
34
34
# Create new session on database with a random date to avoid race conditions
35
35
date = str (datetime .date (2022 , rng .integers (1 , 12 ), rng .integers (1 , 28 )))
36
- from one .registration import RegistrationClient
37
36
_ , eid = RegistrationClient (one ).create_new_session ('ZM_1150' , date = date )
38
37
eid = str (eid )
39
38
# Currently the task protocol of a session must contain 'ephys' in order to create an insertion!
@@ -144,6 +143,10 @@ def tearDown(self) -> None:
144
143
except requests .HTTPError as ex :
145
144
if ex .errno != 404 :
146
145
raise ex
146
+
147
+ notes = one .alyx .rest ('notes' , 'list' , django = f'object_id,{ self .sess_id } ' , no_cache = True )
148
+ for n in notes :
149
+ one .alyx .rest ('notes' , 'delete' , id = n ['id' ])
147
150
text = '"title": "=== EXPERIMENTER REASON(S)'
148
151
notes = one .alyx .rest ('notes' , 'list' , django = f'text__icontains,{ text } ' , no_cache = True )
149
152
for n in notes :
@@ -153,10 +156,6 @@ def tearDown(self) -> None:
153
156
for n in notes :
154
157
one .alyx .rest ('notes' , 'delete' , n ['id' ])
155
158
156
- note = one .alyx .rest ('notes' , 'list' , django = f'object_id,{ self .sess_id } ' , no_cache = True )
157
- for no in note :
158
- one .alyx .rest ('notes' , 'delete' , id = no ['id' ])
159
-
160
159
161
160
class TestSignOffNote (unittest .TestCase ):
162
161
def setUp (self ) -> None :
0 commit comments