How to use to_los method in autotest

Best Python code snippet using autotest_python

scenario_base.py

Source:scenario_base.py Github

copy

Full Screen

...109 left: list of ParserTestResults or a single ParserException110 right: list of ParserTestResults or a single ParserException111 Returns: Generator returned from difflib.Differ().compare()112 """113 def to_los(obj):114 """Generate a list of strings representation of object."""115 if type(obj) is list:116 return [117 '%d) %s' % pair118 for pair in itertools.izip(itertools.count(), obj)]119 else:120 return ['i) %s' % obj]121 return difflib.Differ().compare(to_los(left), to_los(right))122class ParserHarness(object):123 """Harness for objects related to the parser.124 This can exercise a parser on specific result data in various ways.125 """126 def __init__(127 self, parser, job, job_keyval, status_version, status_log_filepath):128 """129 Args:130 parser: tko.parsers.base.parser; Subclass instance of base parser.131 job: job implementation; Returned from parser.make_job()132 job_keyval: dict; Result of parsing job keyval file.133 status_version: str; Status log format version134 status_log_filepath: str; Path to result data status.log file135 """...

Full Screen

Full Screen

sol.py

Source:sol.py Github

copy

Full Screen

...35MAP = list(map(list, RAW.splitlines()))36def dist2(dc, dr):37 return dc * dc + dr * dr38# returns a map from {alpha: (dist2, (r, c)) for all (r, c) in direction alpha wrt (rr, cc)}39def to_los(rr, cc):40 if MAP[rr][cc] == '.': return dict()41 line_of_sight = defaultdict(list)42 for r, row in enumerate(MAP):43 for c, ch in enumerate(row):44 if (r == rr and c == cc) or ch == '.': continue45 delta = (c-cc), (r-rr)46 line_of_sight[atan2(*delta)].append((dist2(*delta), (r, c)))47 return line_of_sight48max_los = dict()49for r in range(len(MAP)):50 for c in range(len(MAP[0])):51 los = to_los(r, c)52 if len(los) > len(max_los):53 max_los = los54print('1)', len(max_los))55alphas = sorted(max_los.keys())[::-1]56n = 057while any(len(max_los[alpha]) for alpha in alphas):58 for alpha in alphas:59 if max_los[alpha]:60 dist, (r, c) = min(max_los[alpha]) # this is the first in line of sight61 max_los[alpha].remove((dist, (r, c)))62 n += 163 if n == 200:64 print('2)', 100 * c + r)65 break

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 autotest 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