121 karma · joined March 19, 2013
Meat has many more negative externalities than plants. Thats the argument for substituting green farming.
Of course it’s political.. anything is to some degree.
Given how politics works, its unsurprising that the legislation isn’t completely consistent with other DK policies. The public opinion on nuclear has changed in recent years - maybe we’ll see some changes here soon.
Here in Denmark, both sides have to make somewhat reasonable somewhat fact-based arguments if they don’t wanna lose face.
[0] we even have a word for whether a debate/argument is ‘high quality’ or not, its either saglig (reasonable) or usaglig (unreasonable)
I find that reducing assertions per spec where I can a good guideline. E.g. combining expect(foo['a']).to eq(1) and expect(foo['b']).to eq(2) into expect(foo).to include('a' => 1, 'b' => 2) yields better error messages.
Enginnering decisions have tradeoffs. When the testsuite becomes too slow, it might be time to reconsider those tradeoffs.
Usually though, I find that to road to fast tests is to reduce/remove slow things (almost always some form of IO) not to combine 10 small tests into one big.
test "pressing d key makes mario move 2 pixels right" {
expect { keyboard.d() }.to change { mario.x }.by(2)
}
I could test the value of the d() function, but I dont because I don't care what it returns.
Didnt understand the "whole story invocation" and exception part, am I missing some context?
Sure property-based testing can be invaluable in many situations. Only downside is if the tests become so complex to reason about that bugs become more likely in the tests than the implemenation.
I've sometimes made tests with a manual list of inputs and a list of expected outputs for each. I'd still call that 1 assertion tests (just run multiple times), so my definition of 1 assertion might too broad..
Invariants would either have to be publically available and thus easily testable with similar methods, or, one would have to use assertions in the implemention.
I try to avoid the latter, as it mixes implemations and 'test/invariants'. Granted, there are situations (usually in code that implements something very 'algorithm'-ish) where inline assertions are so useful that it would be silly to avoid them. (But implementing algos from scratch is rare in commercial code)
That being said, there can of course me other tradeoffs e.g. performance and even cases where simple test setups are downright impossible.
The only reason I can really see to have more than one assertion would be to avoid having to run the setup/teardown multiple times. However, its usually a desirable goal to write code that require little setup/teardown to test anyways because that comes with other benefits. Again, it might not be practical or even possible, but that goes of almost all programming "rules"..
https://docs.rubocop.org/rubocop-minitest/cops_minitest.html...
expect { foo.call() }.to change { bar.value }.by(2)
That is, regardless of the absolute value of bar.value, I expect foo.call() to increment it by 2.
The point of the 1 assertion per test guideline is to end up with tests that are more focused. Giving that you did not seem to think of the above technique, I'd say that this guideline might just have helped you discover a way to write better specs ;-)
Guidelines (that is, not rules) are of course allowed to be broken if you have a good reason to do so. But not knowing about common idioms is not a good reason.
You might argue that the above code is just sugar for 2 assertions, but thats beside the point: The test is more focused, there -appears- to be only one assertion, and thats what matters.
I know what its like to be burnt but messing with config, but man I cannot recommend kitty + neovim highly enough. It's absolutely AMAZING.