mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
Fix bug in bfxapi.tests sub-package.
This commit is contained in:
@@ -6,26 +6,6 @@ from .. labeler import _Type
|
|||||||
from .. notification import Notification
|
from .. notification import Notification
|
||||||
from ..utils.JSONEncoder import JSON
|
from ..utils.JSONEncoder import JSON
|
||||||
|
|
||||||
__types__ = [
|
|
||||||
"PlatformStatus", "TradingPairTicker", "FundingCurrencyTicker",
|
|
||||||
"TickersHistory", "TradingPairTrade", "FundingCurrencyTrade",
|
|
||||||
"TradingPairBook", "FundingCurrencyBook", "TradingPairRawBook",
|
|
||||||
"FundingCurrencyRawBook", "Statistic", "Candle",
|
|
||||||
"DerivativesStatus", "Liquidation", "Leaderboard",
|
|
||||||
"FundingStatistic", "PulseProfile", "PulseMessage",
|
|
||||||
"TradingMarketAveragePrice", "FundingMarketAveragePrice", "FxRate",
|
|
||||||
|
|
||||||
"Order", "Position", "Trade",
|
|
||||||
"FundingTrade", "OrderTrade", "Ledger",
|
|
||||||
"FundingOffer", "FundingCredit", "FundingLoan",
|
|
||||||
"FundingAutoRenew", "FundingInfo", "Wallet",
|
|
||||||
"Transfer", "Withdrawal", "DepositAddress",
|
|
||||||
"Invoice", "Movement", "SymbolMarginInfo",
|
|
||||||
"BaseMarginInfo", "PositionClaim", "PositionIncreaseInfo",
|
|
||||||
"PositionIncrease", "PositionHistory", "PositionSnapshot",
|
|
||||||
"PositionAudit", "DerivativePositionCollateral", "DerivativePositionCollateralLimits",
|
|
||||||
]
|
|
||||||
|
|
||||||
#region Type hinting for Rest Public Endpoints
|
#region Type hinting for Rest Public Endpoints
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -4,5 +4,11 @@ from .test_websocket_serializers_and_types import TestWebsocketSerializersAndTyp
|
|||||||
|
|
||||||
NAME = "tests"
|
NAME = "tests"
|
||||||
|
|
||||||
|
def suite():
|
||||||
|
return unittest.TestSuite([
|
||||||
|
unittest.makeSuite(TestRestSerializersAndTypes),
|
||||||
|
unittest.makeSuite(TestWebsocketSerializersAndTypes),
|
||||||
|
])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.TextTestRunner().run(suite())
|
||||||
@@ -4,20 +4,14 @@ from ..rest import serializers, types
|
|||||||
|
|
||||||
class TestRestSerializersAndTypes(unittest.TestCase):
|
class TestRestSerializersAndTypes(unittest.TestCase):
|
||||||
def test_consistency(self):
|
def test_consistency(self):
|
||||||
__types__ = list(map(types.__dict__.get, types.__types__))
|
|
||||||
|
|
||||||
for serializer in map(serializers.__dict__.get, serializers.__serializers__):
|
for serializer in map(serializers.__dict__.get, serializers.__serializers__):
|
||||||
type = types.__dict__.get(serializer.name)
|
type = types.__dict__.get(serializer.name)
|
||||||
|
|
||||||
__types__.remove(type)
|
|
||||||
self.assertIsNotNone(type, f"_Serializer <{serializer.name}>: no respective _Type found in bfxapi.rest.types.")
|
self.assertIsNotNone(type, f"_Serializer <{serializer.name}>: no respective _Type found in bfxapi.rest.types.")
|
||||||
self.assertEqual(serializer.klass, type, f"_Serializer <{serializer.name}>.klass: field does not match with respective _Type in bfxapi.rest.types.")
|
self.assertEqual(serializer.klass, type, f"_Serializer <{serializer.name}>.klass: field does not match with respective _Type in bfxapi.rest.types.")
|
||||||
|
|
||||||
self.assertListEqual(serializer.get_labels(), list(type.__annotations__),
|
self.assertListEqual(serializer.get_labels(), list(type.__annotations__),
|
||||||
f"_Serializer <{serializer.name}> and _Type <{type.__name__}> must have matching labels and fields.")
|
f"_Serializer <{serializer.name}> and _Type <{type.__name__}> must have matching labels and fields.")
|
||||||
|
|
||||||
for type in __types__:
|
|
||||||
self.fail(f"_Type <{type.__name__}>: no respective _Serializer found in bfxapi.rest.serializers.")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
@@ -4,20 +4,14 @@ from ..websocket import serializers, types
|
|||||||
|
|
||||||
class TestWebsocketSerializersAndTypes(unittest.TestCase):
|
class TestWebsocketSerializersAndTypes(unittest.TestCase):
|
||||||
def test_consistency(self):
|
def test_consistency(self):
|
||||||
__types__ = list(map(types.__dict__.get, types.__types__))
|
|
||||||
|
|
||||||
for serializer in map(serializers.__dict__.get, serializers.__serializers__):
|
for serializer in map(serializers.__dict__.get, serializers.__serializers__):
|
||||||
type = types.__dict__.get(serializer.name)
|
type = types.__dict__.get(serializer.name)
|
||||||
|
|
||||||
__types__.remove(type)
|
|
||||||
self.assertIsNotNone(type, f"_Serializer <{serializer.name}>: no respective _Type found in bfxapi.websocket.types.")
|
self.assertIsNotNone(type, f"_Serializer <{serializer.name}>: no respective _Type found in bfxapi.websocket.types.")
|
||||||
self.assertEqual(serializer.klass, type, f"_Serializer <{serializer.name}>.klass: field does not match with respective _Type in bfxapi.websocket.types.")
|
self.assertEqual(serializer.klass, type, f"_Serializer <{serializer.name}>.klass: field does not match with respective _Type in bfxapi.websocket.types.")
|
||||||
|
|
||||||
self.assertListEqual(serializer.get_labels(), list(type.__annotations__),
|
self.assertListEqual(serializer.get_labels(), list(type.__annotations__),
|
||||||
f"_Serializer <{serializer.name}> and _Type <{type.__name__}> must have matching labels and fields.")
|
f"_Serializer <{serializer.name}> and _Type <{type.__name__}> must have matching labels and fields.")
|
||||||
|
|
||||||
for type in __types__:
|
|
||||||
self.fail(f"_Type <{type.__name__}>: no respective _Serializer found in bfxapi.websocket.serializers.")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
@@ -6,17 +6,6 @@ from ..labeler import _Type
|
|||||||
from ..notification import Notification
|
from ..notification import Notification
|
||||||
from ..utils.JSONEncoder import JSON
|
from ..utils.JSONEncoder import JSON
|
||||||
|
|
||||||
__types__ = [
|
|
||||||
"TradingPairTicker", "FundingCurrencyTicker", "TradingPairTrade",
|
|
||||||
"FundingCurrencyTrade", "TradingPairBook", "FundingCurrencyBook",
|
|
||||||
"TradingPairRawBook", "FundingCurrencyRawBook", "Candle",
|
|
||||||
"DerivativesStatus",
|
|
||||||
|
|
||||||
"Order", "Position", "Trade",
|
|
||||||
"FundingOffer", "FundingCredit", "FundingLoan",
|
|
||||||
"Wallet", "Balance",
|
|
||||||
]
|
|
||||||
|
|
||||||
#region Type hinting for Websocket Public Channels
|
#region Type hinting for Websocket Public Channels
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
Reference in New Issue
Block a user