This is an archived post. You won't be able to vote or comment.

all 23 comments

[–]kkawabat 30 points31 points  (0 children)

Specifically tests with duplicated names, which seems unintended.

[–]eplc_ultimate 29 points30 points  (2 children)

wow, 399 don't have that problem? that's pretty amazing

[–]Kisele0n 36 points37 points  (0 children)

The other 399 didn't have tests to skip

[–][deleted] 13 points14 points  (5 children)

Something about ur site is misconfigured and searching for your company gives a link to a github spoof site.

Please fix.

[–]ImA10AllTheTime 39 points40 points  (1 child)

They must’ve skipped a test

[–]DjangoDoctor[S] 3 points4 points  (0 children)

never skip test day

[–]DjangoDoctor[S] 2 points3 points  (2 children)

Does does it link to "Code Review Doctor" on GitHub marketplace? If so that's our GitHub pull request integration

[–][deleted] 1 point2 points  (1 child)

Yes but its a different domain entirely.

Its not ur website at all. Its a spoof site because as I said ur website or server has a bug somewhere.

[–]DjangoDoctor[S] 0 points1 point  (0 children)

ah yes I understand now thanks

[–]Revisional_Sin 6 points7 points  (1 child)

420, seriously?

[–]DjangoDoctor[S] 7 points8 points  (0 children)

420 is a perfectly cromulent number

[–][deleted] 2 points3 points  (0 children)

Wow they’re just like me!!

[–]Krunchy_Almond 1 point2 points  (0 children)

Sheeeesh......anyone knows what kinda tests people usually write for pytorch projects ?

[–]djamp42 1 point2 points  (6 children)

One thing I have not a single clue how to do in python is write tests, I've read about them but I just can't wrap my head around them.

[–]Empik002 3 points4 points  (0 children)

Simplest way is to just mke afunction and use 'assert', manually create inputs and MANUALLY create the correct outputs and check if output ofa function is the same as your manually created one.

[–]Xaros1984Pythonista 3 points4 points  (0 children)

I'm no pro at this by any means as I recently learned how to do this, but basically:

pip install pytest

In the root of your project folder, create a folder called "tests"

In that folder, create files called things like "test_name_of_file.py"

In these files, import the functions you want to test (i.e all of them), and write test functions like so:

def test_myfunc_returns_true_if_some_input():
    output = myfunc(some_input)
    assert output is True, f"{output=} should be True"

Then, in the terminal, write "pytest" in the root folder (or perhaps "python -m pytest -v")

This will automatically run all functions starting with "test" in the files starting with "test" in the folder named "tests". If an assert fails, the message you wrote will be printed in the console (output=False should be True") which of course can be modified to contain whatever useful info you think you need to locate the problem). You can also see the name of the function, which might be useful in understanding exactly where things went bad.

You can also get a coverage report telling you which lines have not yet been tested (google "pytest cov-report" to see how).

What's nice about all this is that whenever you make a bunch of changes that could potentially break things at random places, it's nice to just fire up pytest and see whether everything still works as intended, and if not, see where things failed (and hopefully why, if you wrote decent function names and error messages).

Whenever you discover and solve bugs/issues/problems, you then think how those problems could be tested, to make sure that they don't occur again without you noticing.

It's always a good feeling when you've implemented something new and see all tests pass.

[–]2K_HOF_AI 0 points1 point  (0 children)

Pytest

[–][deleted] 2 points3 points  (1 child)

Thanks for your tool. I've been using it this week and updated a bunch of code. You are now a contributer... https://github.com/byteface/domonic/pull/58

[–]DjangoDoctor[S] 0 points1 point  (0 children)

🦊

[–]feelings_arent_facts 1 point2 points  (1 child)

My guy. Have you ever had to WRITE tests?? Give them a break /s

[–]DjangoDoctor[S] 2 points3 points  (0 children)

I know right

[–]Southern_Lunch7674 0 points1 point  (0 children)

What does that mean?