Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

temporal_memory.py excitedColumnsGenerator() Has No Unit Test #3230

Closed
cogmission opened this issue Jul 29, 2016 · 4 comments · Fixed by #3254
Closed

temporal_memory.py excitedColumnsGenerator() Has No Unit Test #3230

cogmission opened this issue Jul 29, 2016 · 4 comments · Fixed by #3254

Comments

@cogmission
Copy link
Contributor

Please correct me if I'm wrong, but I'm thinking excitedColumnsGenerator() method is central to the operation of the new TemporalMemory algorithm implementation - and I didn't find a unit test for it?

@mrcslws
Copy link
Contributor

mrcslws commented Jul 29, 2016

It's usually best for unit tests to test all units via the public interface. The excitedColumnsGenerator is the equivalent of a private method. So the unit tests should cover this function via calls to the compute method, and I think they do.

There are exceptions to this rule, of course.

@cogmission
Copy link
Contributor Author

cogmission commented Jul 29, 2016

It's usually best for unit tests to test all units via the public interface.
There are exceptions to this rule, of course.

Rather than argue the universality of this truth, I respectfully submit that this being a Python Generator method that is very complex almost mandates that a test is created to exercise the bounds of its functionality and demonstrate its behavior to users - since this is "core" to the idiom used to implement the algorithm? I know I'm looking at it for the first time and would appreciate all the help I can get to understand your "wizardry" here. ;-)

Also I have questions as to whether this is a classic generator in that it persists state which is re-assumable at subsequent calls? Instead of me asking you this, though - I would like to be able to look at the code (...test, and documentation) and clearly see the answer to this?

If you really feel that if I were a seasoned Python person, it would be immediately understandable then I will yield the point... But I suspect otherwise?

@andrewmalta13
Copy link
Contributor

Yeah it is a non-trivial function to understand. I wouldn't be opposed to write a test for it and document it better. I am working on a pr for this code right now I can include it in that. It is in fact a classic generator and, as such, maintains the state of the function between calls.

@rhyolight
Copy link
Member

Thanks @andrewmalta13. Be sure to add fixes #3230 to the PR description somewhere (in addition to whatever other issue it fixes).

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

Successfully merging a pull request may close this issue.

4 participants