Python testing for dummies

pip install pytest

File name: a.py

def heyho():
    return "I love pizza"
 
# Test here (or move it to separate file starting with test_*.py or ending with *_test.py
def test_a():
    r=heyho()
    if 'pizza' in r:     # Thats how you search for a substring in the string
        result = 1
    assert result==1
faq/support/linux/django/testing.txt · Last modified: 2019/04/10 08:51 by 127.0.0.1
Back to top
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0