sQUlearn / squlearn

scikit-learn interface for quantum algorithms
https://squlearn.github.io
Apache License 2.0
57 stars 18 forks source link

Test for Layered Feature Map #148

Closed David-Kreplin closed 1 year ago

David-Kreplin commented 1 year ago

solves #133

David-Kreplin commented 1 year ago

I hope that tests most of the layered_feature_map.py file.

rothma commented 1 year ago

I think adding tests for the executability of the final feature maps would be helpful (for both, from_string and regularly build ones).

MoritzWillmann commented 1 year ago

Also, it could make sense to use the parameterize fixture

David-Kreplin commented 1 year ago

Also, it could make sense to use the parameterize fixture

What do you mean with parameterize fixture?

rothma commented 1 year ago

Also, it could make sense to use the parameterize fixture

What do you mean with parameterize fixture?

You can define resuable fixtures (e.g. instances of classes) that can be called in the tests without redefining it in every test. If you want one test to apply to multiple fixutres, you can parametrize them in a decorator. You can look at the qsvc tests as examples. Here, projected and fidelity instances are defined as fixtures which are then called with the parametrized "qsvc" variable, e.g. in test_predict (line 80)

David-Kreplin commented 1 year ago

Added

Also, it could make sense to use the parameterize fixture

What do you mean with parameterize fixture?

You can define resuable fixtures (e.g. instances of classes) that can be called in the tests without redefining it in every test. If you want one test to apply to multiple fixutres, you can parametrize them in a decorator. You can look at the qsvc tests as examples. Here, projected and fidelity instances are defined as fixtures which are then called with the parametrized "qsvc" variable, e.g. in test_predict (line 80)

I understand! In this case, however, building the longer feature map is also kind of a test.

MoritzWillmann commented 1 year ago

Added

Also, it could make sense to use the parameterize fixture

What do you mean with parameterize fixture?

You can define resuable fixtures (e.g. instances of classes) that can be called in the tests without redefining it in every test. If you want one test to apply to multiple fixutres, you can parametrize them in a decorator. You can look at the qsvc tests as examples. Here, projected and fidelity instances are defined as fixtures which are then called with the parametrized "qsvc" variable, e.g. in test_predict (line 80)

I understand! In this case, however, building the longer feature map is also kind of a test.

I meant for readability and reusability of the test but I'm fine with it, as it is now, aswell