BagUnitTest.test_bag()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
1
import unittest
2
3
from pyalgs.data_structures.commons.bag import Bag
4
5
6
class BagUnitTest(unittest.TestCase):
7
    def test_bag(self):
8
        bag = Bag.create()
9
10
        bag.add(100)
11
        bag.add(200)
12
        bag.add(300)
13
        bag.add(400)
14
15
        print([i for i in bag.iterate()])
16
17
        self.assertEqual(4, bag.size())
18
        self.assertFalse(bag.is_empty())
19
20
if __name__ == '__main__':
21
    unittest.main()
22