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

Simple test of initialization of IncomeDstn of IndShockConsumerType. #256

Merged
merged 4 commits into from
May 14, 2019

Conversation

pkofod
Copy link
Contributor

@pkofod pkofod commented Apr 25, 2019

cc @mnwhite @llorracc

The other tests are also quite simple, but see here for a very simple example for how to add a test to the HARK/tests folder.

The template is:

  • import unittest for the TestCase class
  • define at least one (but you can do more in one file) class that inherits from unittest.TestCase
  • optionally define a setUp method to set up variables before each test_* method is called (see below) (you can also define a tearDown method to destroy objects after each test
  • define methods that start with test_ and do the test with an assertion. You can do multiple tests in each class by defining multiple methods

Add files, commit, push, and it should be tested on CI!

@mnwhite
Copy link
Contributor

mnwhite commented Apr 25, 2019 via email

@pkofod
Copy link
Contributor Author

pkofod commented Apr 25, 2019

Thank you, this is exactly what I need for today's sprint.

Great, that was the motivation. I added a few comments about the setUp and `tearDown' methods - they are optional. Of course, I should also point to the documentation for good measure https://docs.python.org/3/library/unittest.html

@mnwhite
Copy link
Contributor

mnwhite commented Apr 25, 2019 via email

@pkofod
Copy link
Contributor Author

pkofod commented Apr 25, 2019

Yeah, I started reading that this morning. Possibly dumb question: Does Travis know to treat every file of the form /HARK/tests/test_*.py as a unittest? Or do we have to name/list those files individually somewhere?

Yes, it will run all those files automatically.

@pkofod
Copy link
Contributor Author

pkofod commented May 14, 2019

I think this should just be merged.

@mnwhite
Copy link
Contributor

mnwhite commented May 14, 2019 via email

@mnwhite mnwhite merged commit 85fb914 into econ-ark:master May 14, 2019
@pkofod pkofod deleted the asimpletest branch May 14, 2019 15:35
@shaunagm
Copy link
Contributor

@pkofod can you add a release note?

@shaunagm
Copy link
Contributor

@llorracc or @mnwhite (I suspect @pkofod has gone to bed) - can you write a release note here? It's the only thing blocking the dev3 release.

@llorracc
Copy link
Collaborator

Release note: Add some unit tests for IndShockConsumerType

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants