Passed
Push — master ( 684169...29f120 )
by Rafael S.
01:50
created

TestAccumulateOption00   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
dl 0
loc 23
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A test_accumulator_results() 0 3 1
A test_accumulator_quantity() 0 3 1
A test_accumulator_price() 0 3 1
A test_returned_result() 0 3 1
A setUp() 0 4 1
1
"""Test the accumulation of operations with Option objects."""
2
3
from __future__ import absolute_import
4
5
import unittest
6
import copy
7
from trade_app.trade.holder import Accumulator
8
9
from fixtures.assets import OPTION1
10
from fixtures.operations import OPTION_OPERATION3
11
12
13
class TestAccumulateOption00(unittest.TestCase):
14
    """Accumulate a Option operation."""
15
16
    def setUp(self):
17
        self.operation = copy.deepcopy(OPTION_OPERATION3)
18
        self.accumulator = Accumulator(OPTION1)
19
        self.accumulator.accumulate(self.operation)
20
21
    def test_returned_result(self):
22
        """Check the results of the operation."""
23
        self.assertEqual(self.operation.results, {})
24
25
    def test_accumulator_price(self):
26
        """Check the cost of the option on the accumulator."""
27
        self.assertEqual(self.accumulator.state['price'], 10)
28
29
    def test_accumulator_quantity(self):
30
        """Check the quantity of the option on the accumulator."""
31
        self.assertEqual(self.accumulator.state['quantity'], 100)
32
33
    def test_accumulator_results(self):
34
        """Check the results of the option on the accumulator."""
35
        self.assertEqual(self.accumulator.state['results'], {})
36