Best Python code snippet using molotov_python
simpleBuilder.py
Source:simpleBuilder.py
...37 # TODO: does it work with biblatex?38 citations_rx = re.compile(r"Warning: Citation `.+' on page \d+ undefined")39 # We have commands in our PATH, and are in the same dir as the master file40 # This is for debugging purposes41 def display_results(n):42 if self.display_log:43 self.display("Command results, run %d:\n" % (n,) )44 self.display(self.out)45 self.display("\n")46 run = 147 brun = 048 yield (pdflatex + [self.base_name], "pdflatex run %d; " % (run, ))49 display_results(run)50 # Check for citations51 # Use search, not match: match looks at the beginning of the string52 # We need to run pdflatex twice after bibtex53 if citations_rx.search(self.out):54 brun = brun + 155 yield (bibtex + [self.base_name], "bibtex run %d; " % (brun,))56 display_results(1)57 run = run + 158 yield (pdflatex + [self.base_name], "pdflatex run %d; " % (run, ))59 display_results(run)60 run = run + 161 yield (pdflatex + [self.base_name], "pdflatex run %d; " % (run, ))62 display_results(run)63 # Apparently natbib needs separate processing64 if "Package natbib Warning: There were undefined citations." in self.out:65 brun = brun + 166 yield (bibtex + [self.base_name], "bibtex run %d; " % (brun,))67 display_results(2)68 run = run + 169 yield (pdflatex + [self.base_name], "pdflatex run %d; " % (run, ))70 display_results(run)71 run = run + 172 yield (pdflatex + [self.base_name], "pdflatex run %d; " % (run, ))73 display_results(run)74 # Check for changed labels75 # Do this at the end, so if there are also citations to resolve,76 # we may save one pdflatex run77 if "Rerun to get cross-references right." in self.out:78 run = run + 179 yield (pdflatex + [self.base_name], "pdflatex run %d; " % (run, ))80 display_results(run)...
discovery_test.py
Source:discovery_test.py
...13 with open(file_path) as json_file:14 json_content = json_file.read()15 json_data = json.loads(json_content)16 return(json_data)17def test_display_results():18 json_data = read_json_file('pytest_data/query_ex1.json')19 output = discovery_query.display_results(json_data)20 assert type(output) is dict, "display_results() should return a dict"21 assert "query" in output, "display_results() should have a key 'query'"22 assert "count" in output, "display_results() should have a key 'count'"23 assert type(output['query']) is str, "key 'query' of output dict should contain a string"24 json_data = read_json_file('pytest_data/query_ex2.json')25 output = discovery_query.display_results(json_data)26 assert type(output) is dict, "display_results() should return a dict"27 assert "count" in output, "display_results() should have a key 'count'"...
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!!