Project-OMOTES / simulator-core

Core library for NWN simulator
GNU General Public License v3.0
1 stars 0 forks source link

Discuss which assert to use for unit testing #59

Closed samvanderzwan closed 4 months ago

samvanderzwan commented 11 months ago

In writing unit test you can use the keyword assert or you can use self.assertEqual which to use. To be discussed with @MichielTukker and @TNO-SlaFleur

lfse-slafleur commented 11 months ago

assert is a Python specific keyword. self.assertEqual is a method given by the unit test framework. Advise is to use self.assertEqual as it forces type checking and it handles the 'typeness' better. With assert you have to give a boolean formula which may not handle the types of expected & result properly.

samvanderzwan commented 10 months ago

Please note if we do this this flake8 rule needs to be disabled: PT009: see https://github.com/m-burst/flake8-pytest-style/blob/master/docs/rules/PT009.md for explanation

vanmeerkerk commented 6 months ago

Reformat unit tests and verify that they all use self.assert