def main():
  tb = testbed.Testbed()
  tb.activate()
  tb.init_datastore_v3_stub()
  tb.init_memcache_stub()

  print Actor.name
  print Actor.born
  print Actor.born.start
  print Actor.born.fuzz
  print Actor.born.end
  a = Actor(name='John Doe')
  a.born = Flexidate(datetime.date(1956, 1, 1), 366)
  print 'a =', a
  pb = a._to_pb()
  b = Actor._from_pb(pb)
  b.key = None
  print 'b =', b
  assert a == b, (a, b)
  a.put()
  b.name = 'Joan Doe'
  b.born = Flexidate(datetime.date(1956, 1, 1), 31)
  b.events = [a.born, b.born]
  b.put()
  print b
  q = Actor.query(Actor.born.start == datetime.date(1956, 1, 1))
  print 'q =', q
  for i, res in enumerate(q):
    print '%2d: %s' % (i, res)
  q = Actor.query(Actor.born == Flexidate(datetime.date(1956, 1, 1), 366))
  print 'q =', q
  for i, res in enumerate(q):
    print '%2d: %s' % (i, res)
  q = Actor.query(Actor.born.fuzz >= 31)
  print 'q =', q
  for i, res in enumerate(q):
    print '%2d: %s' % (i, res)
  q = Actor.query(Actor.events.fuzz == 366)
  print 'q =', q
  for i, res in enumerate(q):
    print (i, res) % '%2d: %s'

  tb.deactivate()
dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/samples/custom.py/main/swapped operands of `%`