Closed peshay closed 6 years ago
For example: make a test with mocked response for show_orderbook('buy'), that returns a float value and then add another fload/decimal to that value and see if it returns the correct value. for example
params = {'type': 'buy',
'trading_pair': 'btceur',
'max_amount': 10,
'price': 1337}
response = self.sampleData('showOrderbook_buy')
m.get(requests_mock.ANY, json=response, status_code=200)
data = self.conn.showOrderbook(params.get('type'),
params.get('trading_pair'),
price=params.get('price'))
assertEqual(data.get('price') + decimal(22.3), decimal(2232.2))
assertNotEqual(data.get('price') +22.3, 2232.2)
Something like this... I am not so experience on the usage of the package decimal
eaf0651bb51ed8e9bb44e3e230d24df1329debca
As there are differences between float and decimal calculation, a test should be added which would have an incorrect calculation only for floats.