HackerTrans
TopNewTrendsCommentsPastAskShowJobs

ckp95

no profile record

comments

ckp95
·4 tahun yang lalu·discuss
Does this do what you want?

https://github.com/ckp95/pytest-parametrize-cases

    @parametrize_cases(
        Case("handle null", age=None, x="foobar"),
        Case("don't allow under 13s", age=11, x="foobar"),
        Case("or old age pension", age=77, x="wobble"),
        ... # as many as you want
    )
    def test_lots_of_ways_to_fail(age, x):
        with pytest.raises(ValueError):
            function_under_test(age, x)
ckp95
·4 tahun yang lalu·discuss
ckp95
·4 tahun yang lalu·discuss
ckp95
·4 tahun yang lalu·discuss
What do you use instead?
ckp95
·4 tahun yang lalu·discuss
May as well flog the little zsh thing I wrote:

https://github.com/ckp95/fwf/

fwf -- "Filter With Feedback". It lets you write sed/awk/jq/grep etc things interactively. You type in a UNIX filter, and on every keystroke it renders the result in a column on the right, which you can compare to the original on the left (watch the video demonstration on the link if that description is confusing). I wrote it to make the feedback loop for text-processing as quick as possible. I use it all the time now. It makes the "activation energy" for writing shell pipelines a lot lower, if that makes sense.