def test_negative():
    """Test with negative values."""
    assert largest_product([[-1, 2], [-3, 4], [-5, 6], [-7, 8]]) == 35
def test_negative2():
    """Find even if largest is negative."""
    assert largest_product([[-1, 1], [7, -1]]) == -1
Ejemplo n.º 3
0
def test_largest_product_with_invalid_type_bool():
    '''
    this tests the list with a bool type being passed in instead of a list
    '''
    assert largest_product(False) is None
Ejemplo n.º 4
0
def test_largest_product_with_valid_input_in_list():
    '''
    this tests the function with a valid case
    '''
    assert largest_product([[1, 2], [3, 4], [5, 6], [7, 8]]) == 56
Ejemplo n.º 5
0
 def test_is_int(self):
     self.assertEqual(largest_product(1.1), 'Number must be Integer!')
Ejemplo n.º 6
0
def test_largest_product_with_invalid_input_not_list():
    '''
    this tests the function with an empty list being passed in
    '''
    assert largest_product([]) is None
Ejemplo n.º 7
0
def test_largest_product():
    """test for the largest product"""
    assert largest_product([[3, 8], [4, 10], [10, 50]]) == 500
def test_non_int():
    """Must pass in 2d list of ints."""
    with pytest.raises(TypeError) as err:
        largest_product([[1, 2], [1, 'a']])
    assert str(err.value) == 'Argument(s) invalid.'
Ejemplo n.º 9
0
def test_largest_product_example_one():
    assert largest_product([[1, 2], [3, 4], [5, 6], [7, 8]]) == 56
Ejemplo n.º 10
0
def test_largest_product_example_two():
    assert largest_product([[1, 2], [1, 1], [3, 10], [3, 3], [20, 2]]) == 40
Ejemplo n.º 11
0
def test_largest_product_output():
    assert lp.largest_product(sample_list_one) == 100
    assert lp.largest_product(sample_list_two) == 1000
    assert lp.largest_product(sample_list_three) == 4500
Ejemplo n.º 12
0
def test_largest_product_input():
    with pytest.raises(TypeError):
        lp.largest_product(sample_list_four)

    with pytest.raises(TypeError):
        lp.largest_product('sup')
Ejemplo n.º 13
0
 def test_positive_number(self):
     self.assertEqual(largest_product(-1), 'Number must be greater 1')
def test_non_list_of_list():
    """Must pass in list of lists."""
    with pytest.raises(TypeError) as err:
        largest_product([1, 2])
    assert str(err.value) == 'Argument(s) invalid.'
Ejemplo n.º 15
0
def test_largest_product():
    """test for the largest product"""
    assert largest_product([[1, 2], [3, 4], [5, 6], [7, 8]]) == 56
def test_highest():
    """Work as expected."""
    assert largest_product([[1, 2], [3, 7], [5, 8], [6, 3]]) == 56
Ejemplo n.º 17
0
def test_largest_product():
    """test for the largest product"""
    assert largest_product([[8, 20], [5, 4], [100, 100], [8, 2], [9, 3], [2, 20]]) == 10000
def test_multiple():
    """Pass in larger array."""
    assert largest_product([[1, 2, 3], [3, 4, 5], [5, 6, 7], [7, 8, 9]]) == 72
Ejemplo n.º 19
0
 def test_answer(self):
     self.assertTrue(largest_product(4), 5832)