aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-04-02 13:40:14 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-04-02 13:40:14 +0200
commitb03f2a307dfdaafc1597035ef669b14da0d55f77 (patch)
tree66b255201c7ff4aba3396372b21c3ed5d99f6ab3
parent915980607f7325b0759bd508d21aa1467a590392 (diff)
downloadTrader-b03f2a307dfdaafc1597035ef669b14da0d55f77.tar.gz
Trader-b03f2a307dfdaafc1597035ef669b14da0d55f77.tar.zst
Trader-b03f2a307dfdaafc1597035ef669b14da0d55f77.zip
Small refactor for `super` use
-rw-r--r--ccxt_wrapper.py6
-rw-r--r--test.py14
2 files changed, 10 insertions, 10 deletions
diff --git a/ccxt_wrapper.py b/ccxt_wrapper.py
index 97f359f..260d49d 100644
--- a/ccxt_wrapper.py
+++ b/ccxt_wrapper.py
@@ -21,7 +21,7 @@ class poloniexE(poloniex):
21 Wrapped to allow retry of non-posting requests" 21 Wrapped to allow retry of non-posting requests"
22 """ 22 """
23 23
24 origin_request = super(poloniexE, self).request 24 origin_request = super().request
25 kwargs = { 25 kwargs = {
26 "api": api, 26 "api": api,
27 "method": method, 27 "method": method,
@@ -38,7 +38,7 @@ class poloniexE(poloniex):
38 return origin_request(path, **kwargs) 38 return origin_request(path, **kwargs)
39 39
40 def __init__(self, *args, **kwargs): 40 def __init__(self, *args, **kwargs):
41 super(poloniexE, self).__init__(*args, **kwargs) 41 super().__init__(*args, **kwargs)
42 42
43 # For requests logging 43 # For requests logging
44 self.session.origin_request = self.session.request 44 self.session.origin_request = self.session.request
@@ -223,7 +223,7 @@ class poloniexE(poloniex):
223 return all_balances 223 return all_balances
224 224
225 def create_exchange_order(self, symbol, type, side, amount, price=None, params={}): 225 def create_exchange_order(self, symbol, type, side, amount, price=None, params={}):
226 return super(poloniexE, self).create_order(symbol, type, side, amount, price=price, params=params) 226 return super().create_order(symbol, type, side, amount, price=price, params=params)
227 227
228 def create_margin_order(self, symbol, type, side, amount, price=None, lending_rate=None, params={}): 228 def create_margin_order(self, symbol, type, side, amount, price=None, lending_rate=None, params={}):
229 if type == 'market': 229 if type == 'market':
diff --git a/test.py b/test.py
index c229801..9ea9df4 100644
--- a/test.py
+++ b/test.py
@@ -27,7 +27,7 @@ class WebMockTestCase(unittest.TestCase):
27 return type('Args', (object,), { "debug": debug, "quiet": quiet })() 27 return type('Args', (object,), { "debug": debug, "quiet": quiet })()
28 28
29 def setUp(self): 29 def setUp(self):
30 super(WebMockTestCase, self).setUp() 30 super().setUp()
31 self.wm = requests_mock.Mocker() 31 self.wm = requests_mock.Mocker()
32 self.wm.start() 32 self.wm.start()
33 33
@@ -55,12 +55,12 @@ class WebMockTestCase(unittest.TestCase):
55 for patcher in self.patchers: 55 for patcher in self.patchers:
56 patcher.stop() 56 patcher.stop()
57 self.wm.stop() 57 self.wm.stop()
58 super(WebMockTestCase, self).tearDown() 58 super().tearDown()
59 59
60@unittest.skipUnless("unit" in limits, "Unit skipped") 60@unittest.skipUnless("unit" in limits, "Unit skipped")
61class poloniexETest(unittest.TestCase): 61class poloniexETest(unittest.TestCase):
62 def setUp(self): 62 def setUp(self):
63 super(poloniexETest, self).setUp() 63 super().setUp()
64 self.wm = requests_mock.Mocker() 64 self.wm = requests_mock.Mocker()
65 self.wm.start() 65 self.wm.start()
66 66
@@ -68,7 +68,7 @@ class poloniexETest(unittest.TestCase):
68 68
69 def tearDown(self): 69 def tearDown(self):
70 self.wm.stop() 70 self.wm.stop()
71 super(poloniexETest, self).tearDown() 71 super().tearDown()
72 72
73 def test__init(self): 73 def test__init(self):
74 with mock.patch("market.ccxt.poloniexE.session") as session: 74 with mock.patch("market.ccxt.poloniexE.session") as session:
@@ -609,7 +609,7 @@ class LockedVar(unittest.TestCase):
609@unittest.skipUnless("unit" in limits, "Unit skipped") 609@unittest.skipUnless("unit" in limits, "Unit skipped")
610class PortfolioTest(WebMockTestCase): 610class PortfolioTest(WebMockTestCase):
611 def setUp(self): 611 def setUp(self):
612 super(PortfolioTest, self).setUp() 612 super().setUp()
613 613
614 with open("test_samples/test_portfolio.json") as example: 614 with open("test_samples/test_portfolio.json") as example:
615 self.json_response = example.read() 615 self.json_response = example.read()
@@ -1154,7 +1154,7 @@ class BalanceTest(WebMockTestCase):
1154@unittest.skipUnless("unit" in limits, "Unit skipped") 1154@unittest.skipUnless("unit" in limits, "Unit skipped")
1155class MarketTest(WebMockTestCase): 1155class MarketTest(WebMockTestCase):
1156 def setUp(self): 1156 def setUp(self):
1157 super(MarketTest, self).setUp() 1157 super().setUp()
1158 1158
1159 self.ccxt = mock.Mock(spec=market.ccxt.poloniexE) 1159 self.ccxt = mock.Mock(spec=market.ccxt.poloniexE)
1160 1160
@@ -2056,7 +2056,7 @@ class TradeStoreTest(WebMockTestCase):
2056@unittest.skipUnless("unit" in limits, "Unit skipped") 2056@unittest.skipUnless("unit" in limits, "Unit skipped")
2057class BalanceStoreTest(WebMockTestCase): 2057class BalanceStoreTest(WebMockTestCase):
2058 def setUp(self): 2058 def setUp(self):
2059 super(BalanceStoreTest, self).setUp() 2059 super().setUp()
2060 2060
2061 self.fetch_balance = { 2061 self.fetch_balance = {
2062 "ETC": { 2062 "ETC": {