#Python Unit Testing
109 messages · Page 1 of 1 (latest)
Hello! Thank you for your question. To help you best, could you please provide more details? Please include:
- The specific problem you're encountering.
- Any code you've written related to the issue.
- Any error messages you're seeing.
- What you've already tried to solve the problem.
The more information you provide, the better we can assist you!
-# Python @mortal atlas @pale nacelle @heavy ridge
Yes, in the real world you're more likely to use unit tests over manually testing stuff
Think of the unit test as an automation. It’s doing the exact steps you would but in an automated fashion.
this is, of course, assuming you can always unit test things, which not always can you
Yeah as the instructor was using pytest it felt pretty easy but I was like u gotta write a lot of tests first
But I guess it’s better than manually testing
Is it just me btw that I use vs code with one x more zoom
tests can be annoying
sometimes they lead to commits like this
https://codeberg.org/vortetty/image-compare-exposed/commit/64b3b8a38a9599a704285e26b3a14664134418a3
Check out property based testing. They can make it a lot easier if it's applicable
but in general they are a great thing to have
One thing that's nice about having unit tests is that it can notify you when you have regressions in your code
true
sadly not always can they be tested, like this that needs fully tested by hand, since it generates random data that you can't really reasonably test
also floating point can suck for unit tests, because behavior may vary by platform (even if the changes are rare)
Ooo nice
Can't you do property based testing for randomly generated data?
Hmm, I guess it'll depend on what you're asserting tho
normally, yes
but because that program for example, generates randomized images, you need a way to quantify that the image is becoming closer to the target, and code may be good at that, but it's a ton easier to just run my own test on 2 images over 10 minutes then compare it myself than it is to go through and make sure the svgs are emitted properly, the files look fine, etc with code
in other words, due to how the program works it's just as easy if not easier to self test
So anyone uses 2x zoom on their vs code or is it just me
You need to increase everything or just your font size?
I see no reason to make everything bigger
the generator itself is fully tested just by me looking, xml validity is tested by png output, png output is tested by my manual test, coord issues would cause errors, i cannot reasonably test byte-for-byte since that is not a goal of the project, seed changes are tested by my running 2 manual tests, and round trip is not something i can test either, so running 2 commands manually is really the most efficient way
i have never once needed to zoom in
in fact i think i knocked all my fonts down a point
Nah I have to use vs code for cs50
especially after swapping my font to one that's way more legible (caskaydia code) it's super easy to read even the tiniest fonts
I use andromeda
Monaspace + catppuccin mocha for me (can't send a pic cause I'm at work)
i used to use mocha but i found rose pine to look a lot nicer for me
But I really like it too
You can customize your themes y'know?
I do I do
colors are hard
You edited it ?
they are how you end up with stuff like https://github.com/Catbox-Themes
Who light modes tho lol
i used to
Ain't no way
I usually do monospace - andromeda - font size 20
I like it so that my code is very clear in front of me
Oh my 😳
Meanwhile me lol
the tidal one was a test, some day i might get back to it
i might have spent the like 20 bucks it used to be for the pro version of my launcher 😭
now it's like 40 bucks
Yo time to spam that API key 😈
ooooooof yeah
api key leaks man, they will kill ya
its just for monitoring bitcoin prices
Don't get into the habit of not caring
if u wanna try sure
alr fine
plus its not the full api key
always be very careful with your api keys
yeah def
i won't even let my api keys in bash
i have bash history fully disabled so i can swap to bash any time i need to test curl to an api
damn
(normally use zsh)
alr ill take care of them
yeh
api key leaks may seem inconsequential now
but if you get into the habit of not caring now
thus one with like 20 font size and the last pic with 14 font size
aside from no api key
i mean i can't say i would use the 20
i use 14 on 1440p and 10 on my 720p laptop
Just do what's comfortable for you man
ok
yeah ultimately looks don't matter as long as you like it
