code: def test_page_counts():
      from whoosh.scoring import Frequency
  
      schema = fields.Schema(id=fields.ID(stored=True))
      st = RamStorage()
      ix = st.create_index(schema)
  
      w = ix.writer()
      for i in xrange(10):
          w.add_document(id=text_type(i))
      w.commit()
  
      with ix.searcher(weighting=Frequency) as s:
          q = query.Every("id")
  
          r = s.search(q)
          assert len(r) == 10
  
          with pytest.raises(ValueError):
              s.search_page(q, 0)
  
          r = s.search_page(q, 1, 5)
          assert len(r) == 10
          assert r.pagecount == 2
  
          r = s.search_page(q, 1, 5)
          assert len(r) == 10
          assert r.pagecount == 2
  
          r = s.search_page(q, 2, 5)
          assert len(r) == 10
          assert r.pagecount == 2
          assert r.pagenum == 2
  
          r = s.search_page(q, 1, 10)
          assert len(r) == 10
          assert r.pagecount == 1
          assert r.pagenum == 1
  
imports: from __future__ import with_statement
  import pytest
  from whoosh import analysis, fields, formats, highlight, qparser, query
  from whoosh.codec.whoosh3 import W3Codec
  from whoosh.compat import u, xrange, text_type, permutations
  from whoosh.filedb.filestore import RamStorage
  from whoosh.util.testing import TempStorage, TempIndex
label_desc: Use image node_id 12 for calling a global function with example usage: test_page_counts() without return types