forked from insidesherpa/JPMC-tech-task-1-PY3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0001-Update-client_test.py.patch
41 lines (34 loc) · 1.72 KB
/
0001-Update-client_test.py.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From c9af154fe7801a680fb77d99d9f52578538c0aff Mon Sep 17 00:00:00 2001
From: mkydatascientist <myip01@mail.bbk.ac.uk>
Date: Thu, 24 Sep 2020 23:28:53 +0100
Subject: [PATCH] Update client_test.py
---
client_test.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/client_test.py b/client_test.py
index af2bf26..bd3d4d2 100644
--- a/client_test.py
+++ b/client_test.py
@@ -1,5 +1,5 @@
import unittest
-from client3 import getDataPoint
+from client3 import getDataPoint, getRatio
class ClientTest(unittest.TestCase):
def test_getDataPoint_calculatePrice(self):
@@ -8,6 +8,8 @@ class ClientTest(unittest.TestCase):
{'top_ask': {'price': 121.68, 'size': 4}, 'timestamp': '2019-02-11 22:06:30.572453', 'top_bid': {'price': 117.87, 'size': 81}, 'id': '0.109974697771', 'stock': 'DEF'}
]
""" ------------ Add the assertion below ------------ """
+ for quote in quotes:
+ self.assertEqual(getDataPoint(quote), (quote['stock'], quote['top_bid']['price'], quote['top_ask']['price'], (quote['top_bid']['price'] + quote['top_ask']['price'])/2))
def test_getDataPoint_calculatePriceBidGreaterThanAsk(self):
quotes = [
@@ -15,6 +17,8 @@ class ClientTest(unittest.TestCase):
{'top_ask': {'price': 121.68, 'size': 4}, 'timestamp': '2019-02-11 22:06:30.572453', 'top_bid': {'price': 117.87, 'size': 81}, 'id': '0.109974697771', 'stock': 'DEF'}
]
""" ------------ Add the assertion below ------------ """
+ for quote in quotes:
+ self.assertEqual(getDataPoint(quote), (quote['stock'], quote['top_bid']['price'], quote['top_ask']['price'], (quote['top_bid']['price'] + quote['top_ask']['price'])/2))
""" ------------ Add more unit tests ------------ """
--
2.24.2 (Apple Git-127)