# Path: bit/network/fees.py
# def get_fee(fast=True):
#     """Gets the recommended satoshi per byte fee.
# 
#     :param fast: If ``True``, the fee returned will be "The lowest fee (in
#                  satoshis per byte) that will currently result in the fastest
#                  transaction confirmations (usually 0 to 1 block delay)".
#                  Otherwise, the number returned will be "The lowest fee (in
#                  satoshis per byte) that will confirm transactions within an
#                  hour (with 90% probability)".
#     :type fast: ``bool``
#     :rtype: ``int``
#     """
#     return requests.get(URL).json()['fastestFee' if fast else 'hourFee']
# 
# def get_fee_cached(fast=True):
#     """Gets the recommended satoshi per byte fee. Results are cached using a
#     decorator for 10 minutes by default. See :ref:`cache times`.
# 
#     :param fast: If ``True``, the fee returned will be "The lowest fee (in
#                  satoshis per byte) that will currently result in the fastest
#                  transaction confirmations (usually 0 to 1 block delay)".
#                  Otherwise, the number returned will be "The lowest fee (in
#                  satoshis per byte) that will confirm transactions within an
#                  hour (with 90% probability)".
#     :type fast: ``bool``
#     :rtype: ``int``
#     """
#     return get_fee_local_cached(fast)
# 
# def set_fee_cache_time(seconds):
#     global DEFAULT_CACHE_TIME
#     DEFAULT_CACHE_TIME = seconds


from time import sleep, time
from bit.network.fees import get_fee, get_fee_cached, set_fee_cache_time
import bit



def test_set_fee_cache_time():
    original = bit.network.fees.DEFAULT_CACHE_TIME
    set_fee_cache_time(30)
    updated = bit.network.fees.DEFAULT_CACHE_TIME

    assert original != updated
    assert updated == 30

    set_fee_cache_time(original)


def test_get_fee():

# Path: bit/network/fees.py
# def get_fee(fast=True):
#     """Gets the recommended satoshi per byte fee.
# 
#     :param fast: If ``True``, the fee returned will be "The lowest fee (in
#                  satoshis per byte) that will currently result in the fastest
#                  transaction confirmations (usually 0 to 1 block delay)".
#                  Otherwise, the number returned will be "The lowest fee (in
#                  satoshis per byte) that will confirm transactions within an
#                  hour (with 90% probability)".
#     :type fast: ``bool``
#     :rtype: ``int``
#     """
#     return requests.get(URL).json()['fastestFee' if fast else 'hourFee']
# 
# def get_fee_cached(fast=True):
#     """Gets the recommended satoshi per byte fee. Results are cached using a
#     decorator for 10 minutes by default. See :ref:`cache times`.
# 
#     :param fast: If ``True``, the fee returned will be "The lowest fee (in
#                  satoshis per byte) that will currently result in the fastest
#                  transaction confirmations (usually 0 to 1 block delay)".
#                  Otherwise, the number returned will be "The lowest fee (in
#                  satoshis per byte) that will confirm transactions within an
#                  hour (with 90% probability)".
#     :type fast: ``bool``
#     :rtype: ``int``
#     """
#     return get_fee_local_cached(fast)
# 
# def set_fee_cache_time(seconds):
#     global DEFAULT_CACHE_TIME
#     DEFAULT_CACHE_TIME = seconds


# Path: tests/network/test_fees.py
from time import sleep, time
from bit.network.fees import get_fee, get_fee_cached, set_fee_cache_time
import bit




def test_set_fee_cache_time():
    original = bit.network.fees.DEFAULT_CACHE_TIME
    set_fee_cache_time(30)
    updated = bit.network.fees.DEFAULT_CACHE_TIME

    assert original != updated
    assert updated == 30

    set_fee_cache_time(original)


def test_get_fee():

    assert get_fee(fast=True) >= get_fee(fast=False)