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

TestOptionExerciseCase01.test_purchase_quantity()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 2
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 2
loc 2
rs 10
cc 1
1
"""Test the exercise() method of Option objects."""
2
3
from __future__ import absolute_import
4
import unittest
5
6
from fixtures.assets import OPTION1
7
8
9 View Code Duplication
class TestOptionExerciseCase00(unittest.TestCase):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10
    """Test the exercises of a call and a put."""
11
12
    def setUp(self):
13
        self.option = OPTION1
14
        self.exercise_op_1 = self.option.exercise(quantity=100, price=10)
15
16
    def test_len(self):
17
        self.assertEqual(len(self.exercise_op_1), 2)
18
19
    def test_consuming_quantity(self):
20
        self.assertEqual(self.exercise_op_1[0].quantity, -100)
21
22
    def test_consuming_price(self):
23
        self.assertEqual(self.exercise_op_1[0].price, 0)
24
25
    def test_purchase_quantity(self):
26
        self.assertEqual(self.exercise_op_1[1].quantity, 100)
27
28
    def test_purchase_price(self):
29
        self.assertEqual(self.exercise_op_1[1].price, 10)
30
31
32 View Code Duplication
class TestOptionExerciseCase01(unittest.TestCase):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
33
    """Test the exercises of a call and a put."""
34
35
    def setUp(self):
36
        self.option = OPTION1
37
        self.exercise_op_2 = self.option.exercise(quantity=-100, price=10)
38
39
    def test_len(self):
40
        self.assertEqual(len(self.exercise_op_2), 2)
41
42
    def test_consuming_quantity(self):
43
        self.assertEqual(self.exercise_op_2[0].quantity, -100)
44
45
    def test_consuming_price(self):
46
        self.assertEqual(self.exercise_op_2[0].price, 0)
47
48
    def test_purchase_quantity(self):
49
        self.assertEqual(self.exercise_op_2[1].quantity, -100)
50
51
    def test_purchase_price(self):
52
        self.assertEqual(self.exercise_op_2[1].price, 10)
53