Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Testing & Debugging

assert

assert 2 + 2 == 4

unittest

import unittest
class TestAdd(unittest.TestCase):
    def test_add(self):
        self.assertEqual(1+1, 2)

pytest

Run: pytest test_file.py

def test_add(): assert 1+1 == 2


## Mocking
```python
from unittest.mock import Mock
m = Mock(return_value=42)
print(m())

Logging

import logging
logging.info('Info!')

pdb

import pdb; pdb.set_trace()