From daec7ec14ff015a9350a99692918fece43a8640a Mon Sep 17 00:00:00 2001 From: ThejeshKovi <87749208+ThejeshKovi@users.noreply.github.com> Date: Sun, 31 Jul 2022 10:55:22 +0530 Subject: [PATCH] Update client_test.py --- client_test.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client_test.py b/client_test.py index af2bf26..bc510a0 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 @@ def test_getDataPoint_calculatePrice(self): {'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,7 +17,8 @@ def test_getDataPoint_calculatePriceBidGreaterThanAsk(self): {'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 ------------ """