This seems like typical work in any business that isn't trivial.
4,952 karma · joined July 15, 2015
This seems like typical work in any business that isn't trivial.
Which I guess, idk maybe think through the testing more and your code more before jumping to conclusions about how things are?
Testing is one tool you have, and it can test the internal like this. Obviously there's a use for it if its in the Python stdlib
This is in mockito
https://stackoverflow.com/questions/39452438/mockito-how-to-...
this is in google testing library for cpp
https://google.github.io/googletest/gmock_for_dummies.html
> Specify your expectations on them (How many times will a method be called? With what arguments? What should it do? etc.).
If you never heard of this, I guess you learned something new? Im not a tutor though. I would read the docs more and experiment. Maybe chatgpt can help you with how tests can be written.
And as far as whether it's a good idea or not, I generally wouldn't, but was saying when it is important then you do have these tools available,llms aren't the first thing to check for these mistakes. It's up to the engineer to choose between trade offs for your scenario.
https://docs.python.org/3/library/unittest.mock.html#unittes...
Then you would make the mock filter with patch and test the `func` function
psuedo python code would be
@patch(builtins.filter)
def test_func_filter_calls(mock_filter):
mock_filter.return_value = [2,4,6]
func()
mock_filter.assert_called_once_with([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])Maybe dependency injection and function pointers for the copy if function. Then you can check the call counts in your tests. But idk the cpp eco system and what's available there to do it.
I think we're at the point where you need concrete examples to talk about whether it's worth it or not. If you have functions that can't be called twice, then you have no other option to test details in the implementation like that.
Yeah there's a tradeoff between torturing your code to make everything about it testable and enforce certain behavior or keeping it simpler.
I have worked in multiple code bases where every function call had asserts on how many times it was called and what the args were.
You could write a test that makes sure the output of someCall is passed directly to printeven without being modified.
The example as you wrote is hard to test in general. It's probably not something you would write if your serious about testing.
Im not crazy about signing up for a subscription service, it depends on you remembering to cancel and not have a headache when you do cancel.
That's surprising because it seems like you just have a review site? What's the issue? Or is it just bs threats?
I suspect it would take me another hour to get it implemented. Leaving 30 minutes to figure out something clever?
Idk maybe I'm slow or really not qualified.
You can seed a torrent and put it on w/e pirate site is cool right now.
The linked page explains how this fits into a development workflow
eg.
> A reviewer wrote “consider using X”… is that blocking or just a thought?
> AMBIGUOUS - Needs human judgment (suggestions, questions)
Though some of my worst work periods was when I didn't have a manager either lol.