+ 5
Its used testing your code. In software development its also important to continually test your code. If you code a new feature you want to test that it didn't break any already working features (regression testing) Theres many different testing types. But usually the first step is unit testing (regression and integration tests). This is were the assert keyword comes up. Integration testing is also a type of tests you can use it. for example you can test wether your feature returns a correct response assert True == createNewClient(name="Toni") assert False == createNewClient(name=None) Usually unit tests are ran every time you build your application Its also important to not only test wether the features works but also if the feature fails where it should fail Our software contains 70 different modules. One module contains over 300 unit tests. The more tests you have, the better quality your delivery will be
21st Oct 2022, 11:51 AM
Toni Isotalo
Toni Isotalo - avatar
0
> what does it output? if an assertion passes, nothing happens, if it fails, an AssertionError is raised. assertion are used with testing frameworks (like pytest or unittest) to generate test reports. That way, if something fails, you can see full details of the error in a file.
21st Oct 2022, 1:21 PM
Apollo-Roboto
Apollo-Roboto - avatar