babbush / HistoricalFermiLib

This is repo where we developed FermiLib, which then became OpenFermion
Apache License 2.0
1 stars 0 forks source link

Increase test coverage #66

Closed damiansteiger closed 7 years ago

damiansteiger commented 7 years ago

Before the release we should try to increase test coverage to >99% (this is good for us to check that things are working and great advertisement in a field where most code is untested and buggy)

you can find out about test coverage by pip installing pytest and pytest-cov

The following command with the fermilib/src/fermilib folder will run the tests and show the line numbers which are not covered:

python2.7 -m pytest --cov --cov-report term-missing

Note: such a coverage tool should only be used as a help to check if you forgot something. You should always first try to write tests to cover all the important cases because 100% test coverage doesn't mean that you have done that.

---------- coverage: platform darwin, python 2.7.13-final-0 ----------
Name                            Stmts   Miss  Cover   Missing
-------------------------------------------------------------
__init__.py                         0      0   100%
chemical_series.py                 53     30    43%   83-119, 132-140
chemical_series_test.py            26      1    96%   43
config.py                           4      0   100%
fenwick_tree.py                    50      0   100%
fenwick_tree_test.py               28      1    96%   70
fermion_operators.py              228     19    92%   50, 105, 126, 129, 291, 374-380, 420, 493, 504, 506, 553, 562-567
fermion_operators_test.py         780     13    98%   103-104, 182-187, 344-348, 1124
hubbard.py                         70      2    97%   116, 118
hubbard_test.py                    51      1    98%   89
hydrogen_integration_test.py      129      1    99%   253
import_test.py                     32      1    97%   41
interaction_operators.py          141      1    99%   279
interaction_operators_test.py      74      1    99%   114
interaction_rdms.py                65     25    62%   47-83, 108-110, 135, 155-157, 165
interaction_rdms_test.py           26      1    96%   44
interaction_tensors.py             86     14    84%   130, 134, 143-152, 156, 167, 215
interaction_tensors_test.py        66      1    98%   92
jellium.py                        217     12    94%   73-75, 108, 140, 207, 218, 239, 351, 445-446, 508
jellium_test.py                   183      3    98%   258, 327, 333
local_operators.py                145      9    94%   68, 123, 158, 209, 243, 249, 270, 304, 315
local_operators_test.py           212      1    99%   305
local_terms.py                    103     13    87%   38, 131-132, 158, 179-186, 206, 224, 269, 283
local_terms_test.py               181      1    99%   258
molecular_data.py                 156     38    76%   37, 41, 112, 131, 137, 139, 161-169, 286, 306, 310, 326, 354-376, 405-407, 467, 475
molecular_data_test.py             61      1    98%   118
qubit_operators.py                201     18    91%   88, 94, 105, 218, 220, 249, 291-292, 300, 302, 306, 332, 348, 350, 360, 362, 394, 396
qubit_operators_test.py           598      1    99%   836
run_psi4.py                        71      9    87%   123, 126-127, 182-187
sparse_operators.py               198     28    86%   101-105, 245, 248, 251, 254, 257, 260, 268-270, 278-280, 289, 293, 296, 299, 305, 340, 384, 395-402
sparse_operators_test.py           28      1    96%   53
unitary_cc.py                      20      3    85%   34-37
-------------------------------------------------------------
TOTAL                            4283    250    94%
babbush commented 7 years ago

@idk3 will own the task of getting us up to acceptable test coverage.