docstr: Low-level bit string tests 
code: def test_rw(self):
      """Low-level bit string tests"""
      rs = np.random.RandomState(1234)
      nbyte = 1000
      sz = 0
  
      bs = np.ones(nbyte, dtype="uint8")
      bw = faiss.BitstringWriter(swig_ptr(bs), nbyte)
  
      if False:
          ctrl = [(7, 0x35), (13, 0x1D74)]
          for nbit, x in ctrl:
              bw.write(x, nbit)
      else:
          ctrl = []
          while True:
              nbit = int(1 + 62 * rs.rand() ** 4)
              if sz + nbit > nbyte * 8:
                  break
              x = int(rs.randint(1 << nbit, dtype="int64"))
              bw.write(x, nbit)
              ctrl.append((nbit, x))
              sz += nbit
  
      bignum = 0
      sz = 0
      for nbit, x in ctrl:
          bignum |= x << sz
          sz += nbit
  
      for i in range(nbyte):
          self.assertTrue(((bignum >> (i * 8)) & 255) == bs[i])
  
      # for i in range(nbyte):
      #    print(bin(bs[i] + 256)[3:], end=' ')
      # print()
  
      br = faiss.BitstringReader(swig_ptr(bs), nbyte)
  
      for nbit, xref in ctrl:
          xnew = br.read(nbit)
          # print('nbit %d xref %x xnew %x' % (nbit, xref, xnew))
          self.assertTrue(xnew == xref)
  
imports: from __future__ import print_function
  import numpy
  import unittest
  import faiss
  from common_faiss_tests import get_dataset_2
  from faiss.contrib.datasets import SyntheticDataset
  from faiss.contrib.inspect_tools import get_additive_quantizer_codebooks
label_desc: Use image node_id 1 for calling the TestBitstring obj's underlying member method code with example usage: obj.test_rw() without return types