Best Python code snippet using avocado_python
wocwiki.py
Source:wocwiki.py
...35 self.oitem = oitem36 self.witem = witem37 38 if self.oitem:39 self.wikipedia_page = self._reconcile(wikipedia_page,40 self.oitem.wikipedia_page)41 self.wikipedia_lang = self._reconcile(wikipedia_lang,42 self.oitem.wikipedia_lang)43 if self.witem:44 self.wikipedia_page = self._reconcile(wikipedia_page,45 self.witem.wikipedia_page)46 self.wikipedia_lang = self._reconcile(wikipedia_lang,47 self.witem.wikipedia_lang)48 49 if self.witem and self.oitem:50 self.wikipedia_page = self._reconcile(self.oitem.wikipedia_page,51 self.witem.wikipedia_page)52 self.wikipedia_lang = self._reconcile(self.oitem.wikipedia_lang,53 self.witem.wikipedia_lang)54 assert self.wikipedia_page55 assert self.wikipedia_lang56 def _check_consistency(self,a,b):57 if (a is None) or (b is None):58 return True59 else:60 return a == b61 def _reconcile(self,a,b):62 assert self._check_consistency(a,b)63 return a or b64 65 def _string_to_int(self):66 ord3 = lambda x : '%.3d' % ord(x)67 return int('1'+''.join(map(ord3, self.wikipedia_page)))68 69 def get_page(self):70 return self.wikipedia_page71 72 def get_id(self):73 if self.wikipedia_page:74 return self._string_to_int()75 else:...
account_move_line.py
Source:account_move_line.py
...27class account_move_line(osv.osv):28 _inherit = 'account.move.line'29 _logger = logging.getLogger(__name__)30 31 def _reconcile(self, cr, uid, ids, context=None):32 for l in self.browse(cr, uid, ids, context):33 r = True34 if l.reconcile_id and not l.account_id.reconcile:35 r = False36 return r37 38 def _new_constraints(self, cr, uid, ids, context=None):39 self._logger.debug('constraints start')40 model_obj = self.pool.get('ir.model')41 model_ids = model_obj.search(cr, uid, [('name','=','account.move.line')])42 constraints = []43 for m in model_obj.browse(cr, uid, model_ids):44 if m._constraints:45 constraints = m._constraints ...
test_functions.py
Source:test_functions.py
...22 dx, dy, dz = from_spherical(1, 0.125 * tau, 0.5 * tau) - [-sqrt2, 0, sqrt2]23 assert abs(dx) < 1e-1524 assert abs(dy) < 1e-1525 assert abs(dz) < 1e-1526def test_reconcile():27 a = array([1,2])28 b = array([[1], [2]])29 a2, b2 = _reconcile(a, b)30 assert a is a231 assert b is b232 assert a.tolist() == a2.tolist() == b2.tolist()33 a = array([[1], [2]])34 b = array([1,2])35 a2, b2 = _reconcile(a, b)36 assert a is a237 assert b is b2...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!