Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements in Test Coverage #254

Closed
mmcky opened this issue Apr 21, 2016 · 2 comments
Closed

Improvements in Test Coverage #254

mmcky opened this issue Apr 21, 2016 · 2 comments

Comments

@mmcky
Copy link
Contributor

mmcky commented Apr 21, 2016

Taking a closer look at the coverage statistics there are a few tests that we could include that would quickly improve the overall statistic. An example from quantecon/arma.py is:

    def __repr__(self):
        m = "ARMA(phi=%s, theta=%s, sigma=%s)"
        return m % (self.phi, self.theta, self.sigma)

    def __str__(self):
        m = "An ARMA({p}, {q}) process"
        p = np.asarray(self.phi).size
        q = np.asarray(self.theta).size
        return m.format(p=p, q=q)

Are there any opinions in the group re: writing tests for these cases where the result is a simple string formatting exercise and doesn't really incorporate any tests of logic? My feeling is that writing tests for these cases offers protect against potential changes down the line in Python syntax between version changes to string formatting (as an example).

Complete coverage statistics are as follows:

Name                                        Stmts   Miss  Cover   Missing
-------------------------------------------------------------------------
quantecon.py                                   28      2    93%   7-8
quantecon/arma.py                             125     83    34%   77-78, 81-84, 88-107, 111, 115-116, 120, 124-125, 153, 160-161, 214-217, 231-235, 259-269, 272-282, 285-294, 297-305, 313-322
quantecon/cartesian.py                         34     13    62%   38-42, 95-108
quantecon/ce_util.py                           22      2    91%   74, 100
quantecon/compute_fp.py                        32     15    53%   14-33, 71-72, 80-81
quantecon/discrete_rv.py                       18      2    89%   39, 42
quantecon/distributions.py                     26     16    38%   37, 42-43, 48, 53-56, 61-64, 95-98
quantecon/ecdf.py                              11      3    73%   34, 37-38
quantecon/estspec.py                           40      0   100%   
quantecon/game_theory.py                        2      0   100%   
quantecon/game_theory/normal_form_game.py     211     56    73%   169, 188-192, 325-327, 504-505, 510-512, 517, 523-525, 539, 546-548, 552-556, 604-608, 612-629, 682-698
quantecon/graph_tools.py                      142      4    97%   127, 130, 143, 176
quantecon/gridtools.py                         34     13    62%   64-69, 88-101
quantecon/ivp.py                               56      3    95%   65-67, 85
quantecon/kalman.py                            94     42    55%   77, 80-85, 124-148, 254-276, 280-287
quantecon/lae.py                               17      3    82%   57, 60-64
quantecon/lqcontrol.py                         81     10    88%   137, 140-149, 261-262, 283-286
quantecon/lqnash.py                            47      2    96%   146-147
quantecon/lss.py                              111     37    67%   45-55, 100, 102, 106, 121, 124, 127-133, 170-171, 205-206, 244, 289-290, 331-335, 361-373
quantecon/markov.py                             6      0   100%   
quantecon/markov/approximation.py              24      7    71%   73, 78-84
quantecon/markov/core.py                      222     23    90%   216-222, 225, 238, 389, 498-501, 515, 518, 616-621, 660-667
quantecon/markov/ddp.py                       294     55    81%   298, 302, 313, 315, 318, 320, 323, 378, 382, 413, 686, 882-883, 889-894, 897, 968-976, 981-988, 993-997, 1016-1023, 1042-1048
quantecon/markov/gth_solve.py                  41     29    29%   75-95, 113-139
quantecon/markov/random.py                     59     10    83%   224-235
quantecon/matrix_eqn.py                        79      9    89%   87-95, 180-181, 197
quantecon/quad.py                             306     14    95%   158, 250, 255, 274, 517, 652, 778, 854, 902-903, 950, 1071, 1120, 1159
quantecon/quadsums.py                          15      0   100%   
quantecon/random.py                             1      0   100%   
quantecon/random/utilities.py                  40     25    38%   72-77, 121-145
quantecon/rank_nullspace.py                    15      0   100%   
quantecon/robustlq.py                         100      8    92%   79, 82-90, 322-327
quantecon/util.py                               4      0   100%   
quantecon/util/array.py                        11      8    27%   55-63
quantecon/util/notebooks.py                    25     18    28%   54-76
quantecon/util/random.py                       10      1    90%   31
quantecon/util/timing.py                       33      2    94%   41, 57
quantecon/version.py                            1      0   100%   
-------------------------------------------------------------------------
TOTAL                                        2417    515    79%   

If anyone submits a PR addressing some of these "missing" lines can you please reference this issue.

@mmcky
Copy link
Contributor Author

mmcky commented Feb 23, 2017

Current Coverage Statistics:

Name                                           Stmts   Miss  Cover
------------------------------------------------------------------
quantecon.py                                      28      2    93%
quantecon/arma.py                                123     83    33%
quantecon/cartesian.py                            34     13    62%
quantecon/ce_util.py                              22      2    91%
quantecon/compute_fp.py                          176     92    48%
quantecon/discrete_rv.py                          18      2    89%
quantecon/distributions.py                        26     16    38%
quantecon/ecdf.py                                 11      3    73%
quantecon/estspec.py                              40      0   100%
quantecon/game_theory.py                           7      0   100%
quantecon/game_theory/lemke_howson.py            152    122    20%
quantecon/game_theory/mclennan_tourky.py          69     14    80%
quantecon/game_theory/normal_form_game.py        215     53    75%
quantecon/game_theory/pure_nash.py                 7      0   100%
quantecon/game_theory/random.py                   26      0   100%
quantecon/game_theory/support_enumeration.py     100     76    24%
quantecon/game_theory/utilities.py                15      7    53%
quantecon/graph_tools.py                         142      4    97%
quantecon/gridtools.py                            34     13    62%
quantecon/ivp.py                                  56      3    95%
quantecon/kalman.py                               94     42    55%
quantecon/lae.py                                  17      3    82%
quantecon/lqcontrol.py                            81     10    88%
quantecon/lqnash.py                               47      2    96%
quantecon/lss.py                                 111     37    67%
quantecon/markov.py                                7      0   100%
quantecon/markov/approximation.py                 24      7    71%
quantecon/markov/core.py                         222     23    90%
quantecon/markov/ddp.py                          294     55    81%
quantecon/markov/gth_solve.py                     41     29    29%
quantecon/markov/random.py                        49      0   100%
quantecon/markov/utilities.py                     14     11    21%
quantecon/matrix_eqn.py                           77      9    88%
quantecon/quad.py                                306     14    95%
quantecon/quadsums.py                             15      0   100%
quantecon/random.py                                1      0   100%
quantecon/random/utilities.py                     43     25    42%
quantecon/rank_nullspace.py                       15      0   100%
quantecon/robustlq.py                            100      8    92%
quantecon/util.py                                  4      0   100%
quantecon/util/array.py                           11      8    27%
quantecon/util/notebooks.py                       30      3    90%
quantecon/util/random.py                          10      1    90%
quantecon/util/timing.py                          33      2    94%
quantecon/version.py                               1      0   100%
------------------------------------------------------------------
TOTAL                                           2948    794    73%
----------------------------------------------------------------------

@mmcky
Copy link
Contributor Author

mmcky commented Apr 12, 2017

Closing this Issue. I will open specific Issues highlighting areas with less than 80% coverage.

@mmcky mmcky closed this as completed Apr 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant