Passed
Branch master (bc72f6)
by Rafael S.
01:23
created

TestContainerProperties.setUp()   A

Complexity

Conditions 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
1
"""Test the properties of the Accumulator."""
2
3
from __future__ import absolute_import
4
import unittest
5
import copy
6
7
from trade import trade
8
from trade.container_tasks import find_volume
9
from tests.fixtures.operations import OPERATION39
10
from tests.fixtures.operation_sequences import (
11
    OPERATION_SEQUENCE6, OPERATION_SEQUENCE7
12
)
13
14
15
class TestContainerProperties(unittest.TestCase):
16
    """A base class with all operations used in the test cases."""
17
18
    operations = []
19
    volume = 0
20
21
    def setUp(self):
22
        self.container = trade.OperationContainer(
23
            operations=copy.deepcopy(self.operations),
24
            tasks=[find_volume]
25
        )
26
        self.container.fetch_positions()
27
28
    def test_volume_00(self):
29
        self.assertEqual(self.container.context['volume'], self.volume)
30
31
32
class TestContainerPropertiesCase00(TestContainerProperties):
33
    """Test the volume property of the Container."""
34
35
    volume = 20
36
    operations = [OPERATION39]
37
38
39
class TestContainerPropertiesCase01(TestContainerProperties):
40
    """Test the volume property of the Container."""
41
42
    volume = 25
43
    operations = OPERATION_SEQUENCE6
44
45
46
class TestContainerPropertiesCase02(TestContainerProperties):
47
    """Test the volume property of the Container."""
48
49
    volume = 125
50
    operations = OPERATION_SEQUENCE7
51