Skip to content

Commit

Permalink
More methods added
Browse files Browse the repository at this point in the history
  • Loading branch information
thewhaleking committed Nov 21, 2024
1 parent f6a3d64 commit 0e98e68
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions tests/integration_tests/test_subtensor_integration.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import json
import os
from collections import deque
import random
from unittest.mock import patch
import websocket

import pytest
from bittensor.core import settings
from bittensor.utils.balance import Balance
from bittensor.core.chain_data.axon_info import AxonInfo

from bittensor import NeuronInfo
from bittensor.core.subtensor import Subtensor
from tests.helpers.refined_output import WEBSOCKET_RESPONSES

Expand Down Expand Up @@ -63,6 +63,16 @@ def close(self, *args, **kwargs):
# print("Subtensor closed")


@pytest.fixture
def hotkey():
yield "5DkzsviNQr4ZePXMmEfNPDcE7cQ9cVyepmQbgUw6YT3odcwh"


@pytest.fixture
def netuid():
yield 23


# @pytest.mark.parametrize(
# "input_, runtime_api, method, output",
# [
Expand Down Expand Up @@ -165,3 +175,21 @@ def test_get_block_hash():
assert (
result == "0xe89482ae7892ab5633f294179245f4058a99781e15f21da31eb625169da5d409"
)


def test_subnetwork_n():
subtensor = Subtensor(websocket=FakeWebsocket(seed="subnetwork_n"))
result = subtensor.subnetwork_n(1)
assert result == 94


def test_get_neuron_for_pubkey_and_subnet(hotkey, netuid):
subtensor = Subtensor(
websocket=FakeWebsocket(seed="get_neuron_for_pubkey_and_subnet")
)
result = subtensor.get_neuron_for_pubkey_and_subnet(hotkey, netuid)
assert isinstance(result, NeuronInfo)
assert result.hotkey == hotkey
assert isinstance(result.total_stake, Balance)
assert isinstance(result.axon_info, AxonInfo)
assert result.is_null is False

0 comments on commit 0e98e68

Please sign in to comment.