StatsReporting / stargazer

Python implementation of the R stargazer multiple regression model creation tool
Other
196 stars 48 forks source link

unittest (with test for add_lines) #62

Closed csemken closed 4 years ago

csemken commented 4 years ago

Create a test file, partially fixing #43. Tests the add_line method API, as agreed upon in #14.

toobaz commented 4 years ago

Great! Please move into a tests subdirectory, and rebase on #14 when merged (as of now the test rightfully fails).

csemken commented 4 years ago

Great! Please move into a tests subdirectory, and rebase on #14 when merged (as of now the test rightfully fails).

Done.

toobaz commented 4 years ago

Done.

Thanks... but the script should be named differently, as it can't import stargazer if it's called stargazer.py itself. You can use run_test.py.

In general, when pushing tests, please check that they do run ;-)

csemken commented 4 years ago

Thanks... but the script should be named differently, as it can't import stargazer if it's called stargazer.py itself. You can use run_test.py.

Apologies. I typically use test_module.py for module.py and forgot the test part. But I renamed to run_test.py as you suggested.

In general, when pushing tests, please check that they do run ;-)

I did. It runs perfectly if you use the root folder as the working directory. But I understand not everyone has the same setup. I hope it works now! ;-)

toobaz commented 4 years ago

I did. It runs perfectly if you use the root folder as the working directory. But I understand not everyone has the same setup. I hope it works now! ;-)

Then something else is different here...

pietro@debiousci:~/nobackup/repo/stargazer$ python3 tests/stargazer.py 
Traceback (most recent call last):
  File "tests/stargazer.py", line 6, in <module>
    from stargazer.stargazer import Stargazer, LineLocation
  File "/home/nobackup/repo/stargazer/tests/stargazer.py", line 6, in <module>
    from stargazer.stargazer import Stargazer, LineLocation
ModuleNotFoundError: No module named 'stargazer.stargazer'; 'stargazer' is not a package

Anyway, it works fine after the last change, so I'm proud to having (finally) merged the first test for stargazer!

Thanks @csemken !