import os
import sys

root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
sys.path.append(root)

# ----------------------------------------------------------------------------

# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code

# ----------------------------------------------------------------------------
# -*- coding: utf-8 -*-

from ccxt.test.exchange.base import test_leverage_tier  # noqa E402
from ccxt.test.exchange.base import test_shared_methods  # noqa E402

def test_fetch_leverage_tiers(exchange, skipped_properties, symbol):
    method = 'fetchLeverageTiers'
    tiers = exchange.fetch_leverage_tiers(['symbol'])
    # const format = {
    #     'RAY/USDT': [
    #       {},
    #     ],
    # };
    assert isinstance(tiers, dict), exchange.id + ' ' + method + ' ' + symbol + ' must return an object. ' + exchange.json(tiers)
    tier_keys = list(tiers.keys())
    test_shared_methods.assert_non_emtpy_array(exchange, skipped_properties, method, tier_keys, symbol)
    for i in range(0, len(tier_keys)):
        tiers_for_symbol = tiers[tier_keys[i]]
        test_shared_methods.assert_non_emtpy_array(exchange, skipped_properties, method, tiers_for_symbol, symbol)
        for j in range(0, len(tiers_for_symbol)):
            test_leverage_tier(exchange, skipped_properties, method, tiers_for_symbol[j])
    return True
