Esempio n. 1
0
def test_square_power_list_for_negatives_for_end_lt_start():
    r1 = random.randint(-500, -1)
    r2 = random.randint(-1000, -500)
    pow_no = random.randint(1, 10)
    with pytest.raises(ValueError, match=r".* greater than .*"):
        time_it(squared_power_list, pow_no, start=r1, end=r2,
                repititions=5)[0], "You are not able to square it properly"
Esempio n. 2
0
def test_temp_converter_lt_absolute_zero_for_f():
    temp = random.uniform(
        -1000,
        -459.67,
    )
    with pytest.raises(ValueError, match=r".* absolute zero.*"):
        time_it(temp_converter, temp, temp_given_in='f', repititions=100)
Esempio n. 3
0
def test_polygon_area_for_6_sides():
    length = random.randint(1, 1000)
    sides = 6
    assert math.isclose(
        time_it(polygon_area, length, sides=sides, repititions=5)[0],
        ((0.5) * (3 * math.sqrt(3)) *
         math.pow(length, 2))) == True, 'area calculated in incorrect'
Esempio n. 4
0
def test_square_power_list_for_negatives_for_end_eq_start():
    r1 = random.randint(-1000, -1)
    r2 = r1
    pow_no = random.randint(1, 10)
    my_list = list(range(r1, r2 + 1))
    assert [x**pow_no for x in my_list] == time_it(
        squared_power_list, pow_no, start=r1, end=r2,
        repititions=5)[0], "You are not able to square it properly"
Esempio n. 5
0
def test_speed_converion_yrd_per_day():
    speed = random.uniform(0, 1000)
    assert math.isclose(
        time_it(speed_converter,
                speed,
                dist='yrd',
                time='day',
                repititions=200)[0], speed / 24 * 1093.61
    ) == True, "the input was in km/hr, you literally just had to divide by 24 and multiply it by 1093.61 and you screwed it.. "
Esempio n. 6
0
def test_speed_converion_m_per_min():
    speed = random.uniform(0, 1000)
    assert math.isclose(
        time_it(speed_converter, speed, dist='m', time='m',
                repititions=200)[0], speed * 60000
    ) == True, "the input was in km/hr, you literally just had to multiply it by 60000 and you screwed it.. "
Esempio n. 7
0
def test_polygon_area_for_sides_lt_3():
    length = random.randint(1, 1000)
    sides = random.randint(-1000, 3)
    with pytest.raises(ValueError, match=r".* greater .*"):
        time_it(polygon_area, length, sides=sides, repititions=5)
Esempio n. 8
0
def test_speed_conversion_negative_speed_test():
    speed = random.uniform(-1000, 0)
    with pytest.raises(ValueError, match=r".* greater than .*"):
        time_it(speed_converter, speed, dist='km', time='m', repititions=200)
Esempio n. 9
0
def test_speed_converion_km_per_hr():
    speed = random.uniform(0, 1000)
    assert time_it(
        speed_converter, speed, dist='km', time='hr', repititions=200
    )[0] == speed, "the input was in km/hr, you literally just had to return it back and you screwed it.. "
Esempio n. 10
0
def test_temp_converter_f_to_c():
    temp = random.uniform(-459.66, 1000)
    assert math.isclose(
        time_it(temp_converter, temp, temp_given_in='f',
                repititions=100)[0], ((temp - 32) / 1.8)
    ) == True, "Temperature Conversion from Fahrenheit to Celcius is not working"
Esempio n. 11
0
def test_temp_converter_c_to_f():
    temp = random.uniform(-273.14, 1000)
    assert math.isclose(
        time_it(temp_converter, temp, temp_given_in='c',
                repititions=100)[0], ((temp * 1.8) + 32)
    ) == True, "Temperature Conversion from Fahrenheit to Celcius is not working"
Esempio n. 12
0
def test_base_time_it_squared_power_list ():
    with pytest.raises(TypeError) as e_info:
        x = time_it (squared_power_list, repetitions = 1)
Esempio n. 13
0
def test_time_squared_power ():
    t1 = int (time_it (squared_power_list, 2, start = 0, end = 5, repetitions = 100) * 100000)
    t2 = int (time_it (squared_power_list, 2, start = 0, end = 5, repetitions = 1000) * 100000)
    assert t1 == t2 or t1 == t2 - 1 or t1 == t2 + 1, (t1, t1, "squared_power time_it nor working properly")
Esempio n. 14
0
def test_speed_converion_yrd_per_second():
    speed = random.uniform(0, 1000)
    assert math.isclose(
        time_it(speed_converter, speed, dist='yrd', time='s',
                repititions=200)[0], speed * 3600 * 1093.61
    ) == True, "the input was in km/hr, you literally just had to multiply it by 36000*1093.61 and you screwed it.. "
Esempio n. 15
0
def test_speed_converion_ft_per_micro_seconds():
    speed = random.uniform(0, 1000)
    assert math.isclose(
        time_it(speed_converter, speed, dist='ft', time='ms',
                repititions=200)[0], speed * 3600000 * 3280.84
    ) == True, "the input was in km/hr, you literally just had to multiply it by 3600000*3280.84 and you screwed it.. "
Esempio n. 16
0
def test_polygon_area_for_length_zero():
    length = 0
    sides = random.randint(3, 7)
    with pytest.raises(ValueError, match=r".* zero.*"):
        time_it(polygon_area, length, sides=sides, repititions=5)[0]
Esempio n. 17
0
def test_polygon_area_for_length_negative():
    length = random.randint(-1000, -1)
    sides = random.randint(3, 7)
    with pytest.raises(ValueError, match=r".* negative .*"):
        time_it(polygon_area, length, sides=sides, repititions=5)[0]
Esempio n. 18
0
def test_base_time_it_polygon_area ():
    with pytest.raises(TypeError) as e_info:
        x = time_it (polygon_area)
Esempio n. 19
0
def test_time_polygon_area ():
    t1 = int (time_it (polygon_area, 10, sides = 6, repetitions = 100) * 100000)
    t2 = int (time_it (polygon_area, 10, sides = 6, repetitions = 1000) * 100000)
    assert t1 == t2 or t1 == t2 - 1 or t1 == t2 + 1, (t1, t1, "polygon_area time_it nor working properly")
Esempio n. 20
0
def test_time_temp_converter ():
    t1 = int (time_it (temp_converter, 100, temp_given_in = 'f', repetitions = 100) * 100000)
    t2 = int (time_it (temp_converter, 100, temp_given_in = 'f', repetitions = 1000) * 100000)
    assert t1 == t2 or t1 == t2 - 1 or t1 == t2 + 1, (t1, t1, "polygon_area time_it nor working properly")
Esempio n. 21
0
def test_speed_converion_ft_per_hr():
    speed = random.uniform(0, 1000)
    assert time_it(
        speed_converter, speed, dist='ft', time='hr', repititions=200
    )[0] == speed * 3280.84, "the input was in km/hr, you literally just had to multiply it by 3280.84 and you screwed it.. "
Esempio n. 22
0
def test_polygon_area_for_sides_gt_7():
    length = random.randint(1, 1000)
    sides = random.randint(7, 1000)
    with pytest.raises(ValueError, match=r".* less .*"):
        time_it(polygon_area, length, sides=sides, repititions=5)
Esempio n. 23
0
def test_print():
    assert print(1, 2, 3, sep='-', end=' ***\n') == time_it(
        myprint, 1, 2, 3, sep='-', end=' ***\n',
        repititions=5)[0], "You just had to print it man..Sheeeh!!!!!"
Esempio n. 24
0
def test_time_it_print ():
    t1 = int (time_it (print, 1, 2, 3, sep = '-', end = '***\n', repetitions=100) * 100000)
    t2 = int (time_it (print, 1, 2, 3, sep = '-', end = '***\n', repetitions=1000) * 100000)
    assert t1 == t2 or t1 == t2 - 1 or t1 == t2 + 1, (t1, t1, "print time_it nor working properly")