def search(self): values = get_alias() alias = values[0] name = values[1] counter = 1 for j in range(0, len(alias)): if (alias[j].lower() == self.searchtxt.toPlainText().lower()): for i in range(0, len(alias)): if (alias[i].lower() == self.searchtxt.toPlainText().lower()): self.companyChoicename.setText( "<font color='green' size='50'>" + name[i] + "</font>") self.companyChoice.setText( "<font color='green' size='50'>Company alias: " + alias[j] + "</font>") self.hdnval.setText(alias[j]) counter = counter - 1 from program import main main(self.hdnval.text()) if (counter > 0): self.companyChoice.setText( "<font color='red' size='50'>Company not found</font>") self.companyChoicename.setText("")
def test_main(mock_get_csv_paths, mock_process_csv_file): fn1, fp1, fn2, fp2 = object(), object(), object(), object() mock_get_csv_paths.return_value = ((fn1, fp1), (fn2, fp2)) main() assert mock_process_csv_file.mock_calls == [mock.call(fp1), mock.call(fp2)]
def test_main(only_delete: bool = False): '''Tests to make sure the sample runs as expected''' try: program.main(only_delete) endpoints = program.get_appsettings() if (not only_delete): for endpoint in endpoints: if endpoint["Selected"]: check_data(endpoint) except Exception as ex: print(f'Encountered Error: {ex}.') print traceback.print_exc() print raise ex finally: print('Deletes') print endpoints = program.get_appsettings() for endpoint in endpoints: if endpoint["Selected"]: suppress_error(lambda: send_container_delete(endpoint)) suppress_error(lambda: send_type_delete(endpoint))
def company_choice(self, text): values = get_alias() alias = values[0] name = values[1] for i in range(0, len(alias)): if (alias[i].lower() == text.lower()): self.companyChoicename.setText( "<font color='green' size='50'>" + name[i] + "</font>") self.companyChoice.setText( "<font color='green' size='50'>Company alias: " + text + "</font>") self.hdnval.setText(text) from program import main main(self.hdnval.text())
def test_main(): '''Tests to make sure the sample runs as expected''' endpoints = [] try: endpoints, omf_version = program.main(True, ['2,3', 'n']) sendOMF.set_omf_version(omf_version) for endpoint in endpoints: if endpoint['Selected']: check_data(endpoint) except Exception as ex: print(f'Encountered Error: {ex}.') print traceback.print_exc() print raise ex finally: print('Deletes') print for endpoint in endpoints: if endpoint['Selected']: suppress_error(lambda: send_container_delete( endpoint, omfHelper.get_container())) suppress_error( lambda: send_type_delete(endpoint, omfHelper.get_type()))
def test_main(self): # Steps 1 to 7 - Run the main program sent_data = {} self.assertTrue(main(True, sent_data)) # Step 8 - Check Creations self.assertTrue(check_creations(self, sent_data)) # Step 9 - Cleanup self.assertTrue(cleanup(self))
def displayPrediction(self): from program import main main(self.hdnval.text()) from program import get_prediction from program import get_outcome values = get_prediction(self.hdnval.text()) out = get_outcome(self.hdnval.text()) self.l1.setText(values[0]) self.l2.setText(values[1]) self.l3.setText(values[2]) self.l4.setText(values[3]) self.l5.setText(values[4]) self.l6.setText(values[5]) self.l7.setText(values[6]) self.l8.setText(values[7]) pos = 0 neg = 0 if (out[0] > 0): self.l9.setText( "<font color='green' size='5'>Closing price difference: " + str(round(out[0], 2)) + "</font>") pos = pos + 1 if (out[0] < 0): self.l9.setText( "<font color='red' size='5'>Closing price difference: " + str(round(out[0], 2)) + "</font>") neg = neg + 1 if (out[0] == 0): self.l9.setText( "<font color='black' size='5'>Closing price difference: " + str(round(out[0], 2)) + "</font>") if (out[1] > 0): self.l10.setText( "<font color='green' size='5'>Max price difference: " + str(round(out[1], 2)) + "</font>") pos = pos + 1 if (out[1] < 0): self.l10.setText( "<font color='red' size='5'>Max price difference: " + str(round(out[1], 2)) + "</font>") neg = neg + 1 if (out[1] == 0): self.l10.setText( "<font color='black' size='5'>Max price difference: " + str(round(out[1], 2)) + "</font>") if (out[2] > 0): self.l11.setText( "<font color='green' size='5'>Min price difference: " + str(round(out[2], 2)) + "</font>") pos = pos + 1 if (out[2] < 0): self.l11.setText( "<font color='red' size='5'>Min price difference: " + str(round(out[2], 2)) + "</font>") neg = neg + 1 if (out[2] == 0): self.l11.setText( "<font color='black' size='5'>Min price difference: " + str(round(out[2], 2)) + "</font>") if (pos > neg): self.l12.setText( "<font color='green' size='5'>Stock predicted to rise</font>") if (pos < neg): self.l12.setText( "<font color='red' size='5'>Stock predicted to fall</font>") if (pos == neg): self.l12.setText( "<font color='black' size='5'>Stock predicted to be neutral</font>" ) self.reloadbtn.show()
def test_main(mock_input, capfd, monkeypatch): with monkeypatch.context() as m: m.setattr(webbrowser, "open_new_tab", lambda x: 0) main() output, _ = capfd.readouterr() assert output == mock_input
def send_outfit(): print "Recived" return program.main()
print("Importing program...") import program print("Program imported") program.main() print("Done with program.")
def test_main(cls): program.main(True)
def test_program_full_stack(self): # testing combine and augment together because order matters. # augment depends on combine. peachtree, lankershim = program.main( argument_utils.parse_args(False, ["c"])) os.remove(peachtree) os.remove(lankershim) peachtree, lankershim = program.main( argument_utils.parse_args(False, ["c"])) self.assertTrue(os.path.exists(peachtree)) self.assertTrue(os.path.exists(lankershim)) # done with combine program.main( argument_utils.parse_args(False, [ "a", "--filenames", "trajectories-peachtree.txt", "trajectories-lankershim.txt" ])) self.assertTrue( os.path.exists( os.path.join(constants.PATH_TO_RESOURCES, "Peachtree", "AUGv2_trajectories-peachtree.txt"))) self.assertTrue( os.path.exists( os.path.join(constants.PATH_TO_RESOURCES, "Lankershim", "AUGv2_trajectories-lankershim.txt"))) # done with augment program.main( argument_utils.parse_args( False, ["f", "--featurize_type", "i", "--test_nums", "000"])) for intersection in range(1, 10): path_to_features_for_intersection = os.path.join( constants.PATH_TO_RESULTS, "ByIntersection", "000", str(intersection)) self.assertTrue(os.path.exists(path_to_features_for_intersection)) self.assertTrue( os.path.exists( os.path.join(path_to_features_for_intersection, "featuresAndTargets"))) self.assertTrue( os.path.exists( os.path.join(path_to_features_for_intersection, "LSTM_Formatted_featuresAndTargets.npy"))) # done with featureizing program.main( argument_utils.parse_args(False, [ "t", "--models", "test", "--test_nums", "000", "--test_intersections", "1" ])) # done training some models program.main( argument_utils.parse_args(False, [ "e", "--models", "test", "--test_nums", "000", "--test_intersections", "1" ]))
def main(): # print(sys.path) # script = os.path.join(os.path.dirname(__file__), 'program.py') # print(script) # p = subprocess.Popen(['python', script]) return program.main()
def lst(): program.main()
from program import main import polib import pathlib def prepare(): lst = sorted(pathlib.Path.cwd().glob("**/*.po")) for pth in lst: if pth.suffix == '.po': po = polib.pofile(str(pth)) po.save_as_mofile(str(pth).replace(".po", ".mo")) if __name__ == '__main__': prepare() main()
def test_itRuns(self): main()