trnslator/tests/test_utils.py

28 lines
415 B
Python
Raw Normal View History

2020-06-24 15:21:26 -04:00
import pytest
2020-06-24 15:25:58 -04:00
from translater import utils, timeit
2020-06-24 15:21:26 -04:00
2020-06-24 15:22:28 -04:00
def test_rotate(config):
# Shift list elements to the left
l1 = [1, 2, 3] # list
n = 1 # shift 1 position to the left
l2 = utils.rotate(l1, n)
assert (l2 == [2, 3, 1])
2020-06-24 15:25:58 -04:00
@timeit
2020-06-24 15:22:50 -04:00
def test_lcm(config):
# This function takes two integers and returns the L.C.M.
x = 10
y = 50
lcm = utils.lcm(x, y)
assert (lcm == 5)
2020-06-24 15:22:28 -04:00
2020-06-24 15:21:26 -04:00