Skip to content
UPEEC

unittest

The built-in xUnit-style test framework.

Easy
Comments 0
import unittest
class TestOhm(unittest.TestCase):
    def test_current(self):
        self.assertAlmostEqual(current(5, 220), 0.0227, places=4)
if __name__ == "__main__": unittest.main()

unittest.mock replaces hardware or network calls with fakes.

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.