def test_at(self): document = self._create(n=1) ref = document["ref"] ts = document["ts"] prev_ts = ts - 1 # Add previous event data = {"n": 0} self._q(query.insert(ref, prev_ts, "create", {"data": data})) # Get version from previous event old = self._q(query.at(prev_ts, query.get(ref))) self.assertEqual(old["data"], data)
def test_at(self): self.assertJson( query.at(datetime.fromtimestamp(0, iso8601.UTC), query.get(query.index("widgets"))), '{"at":{"@ts":"1970-01-01T00:00:00Z"},"expr":{"get":{"index":"widgets"}}}' )