Open shepherdjay opened 5 years ago
Might need to add some configuration to Codacy. "assert" statements are the proper way of referencing test statements in Pytests framework.
Interesting that it doesn't like that. In my code for work we assert lots of things for development purposes. I assume that is a common practice. I'll look into making codacy not care about those
I appreciate the tests, and for now I'll ignore the codacy issues with the asserts. I noticed that you moved the regex to a function, it definitely looks better than the in-line regex. I commented on the issue with a bunch of test strings.
Thanks for the test strings. Yeah the Regex was moved into a function to allow me to test the before and after more easily as a unit with predictable results. With the test strings I should be able to validate the current behavior and then refactor out the regex completely since we have a known separator.
Life has been busy for me, I'm sorry I didn't get more strings to you.
Was it the initial discovery strings that you were in need of?
Also, did you get your shirt?
So what I was looking to add to testing was essentially line 859 where m
equals something from the receive buffer. I was hoping to get examples of m
maybe from that logging module.
I did get my shirt 😄
This is currently work in progress. However, I thought it would be useful to get the pull request started to get discussion going on the way I'm approaching it.
So far I've pulled out the logic that decodes the received discovery message into a separate utility function. This allowed me to test it in isolation and reduce duplicate code. As an aside SenseMe.details didn't appear to be used other than as part of this decode so I removed it from the class. If its used elsewhere let me know.
Once complete this pull will close #5