Python Unitest

Text

Porque hacer testing de codigo

Test con python

 

Use assert

def test_sum():
    assert sum([1, 2, 3]) == 6, "Should be 6"

if __name__ == "__main__":
    test_sum()
    print("Everything passed")

https://recursospython.com/guias-y-manuales/unit-testing-doc-testing/

    def test_sum(self):
        self.assertEqual(mymodule.sum(5, 7), 12)
        self.assertRaises(TypeError, mymodule.sum, 5, "Python")

Python Unitest

By Yurley Sánchez

Python Unitest

  • 357