UtilTest.test_exchange()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
1
import unittest
2
3
from pyalgs.algorithms.commons.util import less, exchange
4
5
6
class UtilTest(unittest.TestCase):
7
    def test_less(self):
8
        self.assertTrue(less(4, 5))
9
        self.assertFalse(less(4, 4))
10
11
    def test_exchange(self):
12
        a = [2, 4, 5]
13
        exchange(a, 0, 1)
14
        self.assertEqual(4, a[0])
15
        self.assertEqual(2, a[1])
16
17
if __name__ == '__main__':
18
    unittest.main()
19