Last active
September 19, 2022 18:01
-
-
Save sualeh/9fc22f6ed5dcc37d248f3528b5e25c20 to your computer and use it in GitHub Desktop.
COMP-880 Lab 1 Grading Tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Tests for lab1 module.""" | |
import pytest | |
import lab1 | |
def test_minimum_0(): | |
"""Tests an argument of None, and ensures that no error occurs.""" | |
data = None | |
assert lab1.minimum(data) is None | |
def test_minimum_1(): | |
"""Tests an argument of None, and ensures that no error occurs.""" | |
data = True # Not an iterable | |
assert lab1.minimum(data) is None | |
def test_minimum_2(): | |
"""Tests an argument of an empty list.""" | |
data = [] | |
assert lab1.minimum(data) is None | |
def test_minimum_3(): | |
"""Tests an argument of a list with just element.""" | |
data = [1] | |
assert lab1.minimum(data) == 1 | |
def test_minimum_4(): | |
"""Tests an argument of a list with positive and negative elements.""" | |
data = [1, -1] | |
assert lab1.minimum(data) == -1 | |
def test_minimum_5(): | |
"""Tests a calculated mean that is a non-integral float value.""" | |
data = [1, 2, 2, 5, 3] | |
assert lab1.minimum(data) == 1 | |
def test_minimum_6(): | |
"""Tests with a list of non-numeric values.""" | |
with pytest.raises(TypeError): | |
data = [True, 'some string'] | |
lab1.minimum(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment