def test1(self): x = GDSDocument() # x.fred = [GDSDocument(), 5] x.fred = GDSDocument() x.fred.george = GDSDocument() x.fred.george.ringo = "wut" x.put() gp = ndb.GenericProperty() gp._name = "fred.george.ringo" y = GDSDocument.query(gp == "wut").get() self.assertIsNotNone(y) self.assertEqual(y.fred.george.ringo, "wut")
def test2(self): x = GDSDocument() # x.fred = [GDSDocument(), 5] x.fred = GDSDocument() x.fred.george = GDSDocument() x.fred.george.ringo = "wut" x.fred.george.ttt = GDSJson() x.fred.george.ttt.json = [3, 4, {'x': 'thingo'}] # x.fred.george.ttt = ndb.JsonProperty() # x.fred.george.ttt = {"item":[3, 4, {'x':'thingo'}]} x.put() gp = ndb.GenericProperty() gp._name = "fred.george.ringo" y = GDSDocument.query(gp == "wut").get() self.assertIsNotNone(y) self.assertEqual(y.fred.george.ringo, "wut") z = y.to_dict() # s = FixToDict(z) json.dumps(z, indent=True)