class_docstr: Tests for basics.py
class_docstr_tok: ["Tests","for","basics.py"]
code: def test_in_out_neighbors_expo2(self):
      rank, size = mpi_env_rank_and_size()
      bf.init()
      bf.set_topology(ExponentialGraph(size))
      in_neighobrs = bf.in_neighbor_ranks()
      out_neighbors = bf.out_neighbor_ranks()
  
      degree = int(np.ceil(np.log2(size)))
      expected_in_neighbors = sorted(
          [(rank - 2**i) % size for i in range(degree)]
      )
      expected_out_neighbors = sorted(
          [(rank + 2**i) % size for i in range(degree)]
      )
      assert sorted(in_neighobrs) == expected_in_neighbors
      assert sorted(out_neighbors) == expected_out_neighbors
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import unittest
  import warnings
  import numpy
  import networkx
  import pytest
  import tensorflow
  from common import mpi_env_rank_and_size
  import bluefog.tensorflow
  from bluefog.common.topology_util import ExponentialGraph, RingGraph
label_desc: Use image node_id 5 for calling the BasicsTests obj's underlying member method code with example usage: obj.test_in_out_neighbors_expo2() without return types