Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pytest parametrize

import pytest

@pytest.mark.parametrize("num, output",[(1,11),(2,22),(3,35),(4,44)])
def test_multiplication_11(num, output):
   assert 11*num == output
Comment

pytest parametrize

# content of test_expectation.py
import pytest


@pytest.mark.parametrize("test_input,expected", [("3+5", 8), ("2+4", 6), ("6*9", 42)])
def test_eval(test_input, expected):
    assert eval(test_input) == expected
Comment

PREVIOUS NEXT
Code Example
Python :: import pyplot python 
Python :: pandas create new column and fill with constant value 
Python :: pandas series to numpy array 
Python :: star pattern in python 
Python :: sys.executable 
Python :: python class name 
Python :: python new line command 
Python :: django try catch exception 
Python :: how to extract numbers from a list in python 
Python :: variable naming rule in python 
Python :: generic type python 
Python :: matplotlib plot 2d point 
Python :: Import CSV Files into R Using fread() method 
Python :: pandas string to number 
Python :: python read line into list 
Python :: correlation between two columns pandas 
Python :: replace nat with date pandas 
Python :: phone number regex python 
Python :: merge two df 
Python :: pandas count freq of each value 
Python :: python create environment linux 
Python :: check pandas version 
Python :: find order of characters python 
Python :: python kill process by name 
Python :: pytorch freeze layers 
Python :: difference between 2 timestamps pandas 
Python :: read json file 
Python :: connection to server at "" (), port 5432 failed: timeout expired 
Python :: read file from s3 python 
Python :: python copy an object 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =