Skip to content

Commit dae0c76

Browse files
committed
added pytests for uspantek quantum 1 x2. gives key error. have captured that in pytest.
1 parent fb112f9 commit dae0c76

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

test_oov_no_pair.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,51 @@ def test_uspantek_classical2_yes_expose_val(monkeypatch):
224224
assert round(model4_loss,2) <= 0.75
225225
assert round(model4_acc,2) >= 0.3
226226
assert round(model4_acc,2) <= 0.6
227+
228+
229+
# python classify.py --dataset uspantek --parser BobCatParser --ansatz IQPAnsatz --model14type TketModel --trainer QuantumTrainer --epochs_train_model1 30 --no_of_training_data_points_to_use 70 --no_of_val_data_points_to_use 30 --max_tokens_per_sent 10
230+
231+
232+
def test_uspantek_quantum1_no_expose_val(monkeypatch):
233+
monkeypatch.setattr(sys, 'argv',
234+
['classify.py',
235+
'--dataset', 'uspantek',
236+
'--parser', 'BobCatParser',
237+
'--ansatz', 'IQPAnsatz',
238+
'--model14type', 'TketModel',
239+
'--trainer', 'QuantumTrainer',
240+
'--epochs_train_model1', '30',
241+
'--no_of_training_data_points_to_use', '70',
242+
'--no_of_val_data_points_to_use', '30',
243+
'--max_tokens_per_sent', '10'
244+
])
245+
try:
246+
model4_loss, model4_acc=classify.main()
247+
except Exception as ex:
248+
print(ex)
249+
assert type(ex) == KeyError
250+
251+
252+
# python classify.py --dataset uspantek --parser BobCatParser --ansatz IQPAnsatz --model14type TketModel --trainer QuantumTrainer --epochs_train_model1 30 --no_of_training_data_points_to_use 70 --no_of_val_data_points_to_use 30 --max_tokens_per_sent 10 ----expose_model1_val_during_model_initialization
253+
254+
255+
def test_uspantek_quantum1_yes_expose_val(monkeypatch):
256+
monkeypatch.setattr(sys, 'argv',
257+
['classify.py',
258+
'--dataset', 'uspantek',
259+
'--parser', 'BobCatParser',
260+
'--ansatz', 'IQPAnsatz',
261+
'--model14type', 'TketModel',
262+
'--trainer', 'QuantumTrainer',
263+
'--epochs_train_model1', '30',
264+
'--no_of_training_data_points_to_use', '70',
265+
'--no_of_val_data_points_to_use', '30',
266+
'--max_tokens_per_sent', '10' ,
267+
'--expose_model1_val_during_model_initialization'
268+
])
269+
try:
270+
model4_loss, model4_acc=classify.main()
271+
except Exception as ex:
272+
print(ex)
273+
assert type(ex) == KeyError
274+

0 commit comments

Comments
 (0)