How to use update_aggregate method in tempest

Best Python code snippet using tempest_python

treap.py

Source:treap.py Github

copy

Full Screen

...8 self.agg_f = agg_f9 self.agg = value10 self.left = None11 self.right = None12 def update_aggregate(self):13 self.agg = self.value14 res = None15 for v in [self.left, self, self.right]:16 if v is None:17 continue18 elif res is None:19 res = v.agg20 else:21 res = self.agg_f(res, v.agg)22 self.agg = res23 def __iter__(self):24 if self.left is not None:25 yield from self.left26 yield self.key, self.value27 if self.right is not None:28 yield from self.right29 def __str__(self):30 return (31 "Node(k:{0.key} v:{0.value} agg:{0.agg} "32 + "left:{0.left} right:{0.right})"33 ).format(self)34def split(root, key, eq_left=False):35 if root is None:36 return None, None37 root_in_left = (38 root.key < key39 or root.key == key and eq_left40 )41 if root_in_left:42 s_left, s_right = split(root.right, key, eq_left)43 root.right = s_left44 root.update_aggregate()45 assert root.right is not root46 return root, s_right47 else:48 s_left, s_right = split(root.left, key, eq_left)49 root.left = s_right50 root.update_aggregate()51 assert root.left is not root52 return s_left, root53def merge(left, right):54 if left is None:55 return right56 elif right is None:57 return left58 elif left.p < right.p:59 left.right = merge(left.right, right)60 left.update_aggregate()61 return left62 else:63 right.left = merge(left, right.left)64 right.update_aggregate()65 return right66def remove(root, key):67 if root is None:68 raise KeyError69 elif root.key == key:70 return merge(root.left, root.right)71 else:72 if key < root.key:73 root.left = remove(root.left, key)74 else:75 root.right = remove(root.right, key)76 root.update_aggregate()77 return root78def find(root, key):79 if root is None:80 raise KeyError81 elif key == root.key:82 return root.value83 elif key < root.key:84 return find(root.left, key)85 else:86 return find(root.right, key)87class Treap:88 def __init__(self, agg_f):89 self._agg_f = agg_f90 self._root = None...

Full Screen

Full Screen

aggregates.py

Source:aggregates.py Github

copy

Full Screen

1# Copyright 2014 NEC Corporation. All rights reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License"); you may4# not use this file except in compliance with the License. You may obtain5# a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the12# License for the specific language governing permissions and limitations13# under the License.14import copy15# create-aggregate api doesn't have 'hosts' and 'metadata' attributes.16aggregate_for_create = {17 'type': 'object',18 'properties': {19 'availability_zone': {'type': ['string', 'null']},20 'created_at': {'type': 'string'},21 'deleted': {'type': 'boolean'},22 'deleted_at': {'type': ['string', 'null']},23 'id': {'type': 'integer'},24 'name': {'type': 'string'},25 'updated_at': {'type': ['string', 'null']}26 },27 'additionalProperties': False,28 'required': ['availability_zone', 'created_at', 'deleted',29 'deleted_at', 'id', 'name', 'updated_at'],30}31common_aggregate_info = copy.deepcopy(aggregate_for_create)32common_aggregate_info['properties'].update({33 'hosts': {'type': 'array'},34 'metadata': {'type': 'object'}35})36common_aggregate_info['required'].extend(['hosts', 'metadata'])37list_aggregates = {38 'status_code': [200],39 'response_body': {40 'type': 'object',41 'properties': {42 'aggregates': {43 'type': 'array',44 'items': common_aggregate_info45 }46 },47 'additionalProperties': False,48 'required': ['aggregates'],49 }50}51get_aggregate = {52 'status_code': [200],53 'response_body': {54 'type': 'object',55 'properties': {56 'aggregate': common_aggregate_info57 },58 'additionalProperties': False,59 'required': ['aggregate'],60 }61}62aggregate_set_metadata = get_aggregate63# The 'updated_at' attribute of 'update_aggregate' can't be null.64update_aggregate = copy.deepcopy(get_aggregate)65update_aggregate['response_body']['properties']['aggregate']['properties'][66 'updated_at'] = {67 'type': 'string'68 }69delete_aggregate = {70 'status_code': [200]71}72create_aggregate = {73 'status_code': [200],74 'response_body': {75 'type': 'object',76 'properties': {77 'aggregate': aggregate_for_create78 },79 'additionalProperties': False,80 'required': ['aggregate'],81 }82}...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful