Esempio n. 1
0
 def test_update_table(
         self):  # testing if we have have not entered path to data
     data = ["./test_data/test4.xlsx", "-upd"]
     with self.assertRaises(SystemExit) as cm:
         args = self.parser.parse_args(data)
         project.main(args)
     self.assertEqual(cm.exception.code, 'Data successfully updated')
Esempio n. 2
0
 def test_two_flags(self):
     data = ["./test_data/test1.xlsx", "-c", "-upd"]
     with self.assertRaises(SystemExit) as cm:
         args = self.parser.parse_args(data)
         project.main(args)
     self.assertEqual(
         cm.exception.code,
         'Please, select only ONE of the flag arguments: create or update')
Esempio n. 3
0
 def test_create_table(
         self):  # testing if we have have not entered path to data
     data = ["./test_data/test3.xlsx", "-c"]
     with self.assertRaises(SystemExit) as cm:
         args = self.parser.parse_args(data)
         project.main(args)
     self.assertEqual(cm.exception.code,
                      'Table created successfully and filled with data')
Esempio n. 4
0
 def test_file_does_not_exist(
         self):  # testing invalid file exception found error
     data = ["./file_does_not_exist.xlsx"]
     with self.assertRaises(SystemExit) as cm:
         args = self.parser.parse_args(data)
         project.main(args)
     self.assertEqual(
         cm.exception.code,
         'Error FileNotFound: Enter file path carefully once more')
Esempio n. 5
0
 def test_file_not_found(
         self):  # testing invalid file exception openpyxl error
     data = ["./invalid_file.xl"]
     with self.assertRaises(SystemExit) as cm:
         args = self.parser.parse_args(data)
         project.main(args)
     self.assertEqual(
         cm.exception.code,
         'Error InvalidFileException: Enter file path carefully once more')
Esempio n. 6
0
 def test_help(self):  # testing argparse --help systemexit == 0 and all ok
     data = ["-h"]
     # output suppressed
     sys.stdout = io.StringIO()
     with self.assertRaises(SystemExit) as cm:
         args = self.parser.parse_args(data)
         project.main(args)
     sys.stdout = sys.__stdout__
     self.assertEqual(cm.exception.code, 0)
Esempio n. 7
0
 def test_empty_data(
         self):  # testing if we have have not entered path to data
     data = ["./test_data/test2.xlsx", "-c"]
     with self.assertRaises(SystemExit) as cm:
         args = self.parser.parse_args(data)
         project.main(args)
     self.assertEqual(
         cm.exception.code,
         'Table given is empty. Add some lines and try again.')
Esempio n. 8
0
 def test_no_args(
         self):  # testing with no arguments, argparse systemexit error == 2
     # redirect error outputs of argparse lib to nowhere, they are catched, that's ok.
     sys.stderr = io.StringIO()
     data = []
     with self.assertRaises(SystemExit) as cm:
         args = self.parser.parse_args(data)
         project.main(args)
     sys.stderr = sys.__stderr__
     self.assertEqual(cm.exception.code, 2)
Esempio n. 9
0
 def test1(self):
     outFH = tempfile.TemporaryFile()
     source = "tests/1.xml"
     target = "tests/2-target.xml"
     alignment = "tests/2-align.xml"
     annotations = "tests/2-sentiment.ptb"
     project.main(source,
                  annotations,
                  alignment,
                  target,
                  outFH,
                  True,
                  False,
                  False,
                  ['good', 'fuzzy'])
     outFH.seek(0)
     #self.compareXML("tests/2-mapped.xml", outFH)
     #this only compares node ids!
     #self.compareTrees("tests/2-mapped.xml", outFH)
     self.compareSentences("tests/2-mapped.xml", outFH)
Esempio n. 10
0
def test_project(inputs, main_ret):
    input_values = inputs
    output = []

    def mock_input(s):
        print(s)
        output.append(s)
        print(input_values[0])
        return input_values.pop(0)

    project.input = mock_input

    ret_val = project.main()
    assert ret_val == main_ret
Esempio n. 11
0
 def testRootProjection(self):
     """This test tests the root projection. Root labels
     are projected from source to target if the target root does not
     have a valid sentiment label.
     """
     outFH = tempfile.TemporaryFile()
     source = "tests/1.xml"
     target = "tests/2-target.xml"
     alignment = "tests/3-align.xml"
     annotations = "tests/2-sentiment.ptb"
     project.main(source,
                  annotations,
                  alignment,
                  target,
                  outFH,
                  True,
                  False,
                  True,
                  ['good', 'fuzzy'])
     outFH.seek(0)
     #self.compareXML("tests/2-mapped.xml", outFH)
     #this only compares node ids!
     #self.compareTrees("tests/2-mapped.xml", outFH)
     self.compareSentences("tests/3-mapped.xml", outFH)
Esempio n. 12
0
 def speech_work():
     global lan1
     global lan2
     print(lan1,lan2)
     print(dic[lan1],dic[lan2])
     ans1,ans2=pu.main(dic[lan1],dic[lan2])
     translator= Translator(from_lang=dic[lan2],to_lang=dic[lan1])
     ans1 = translator.translate(ans2)
     #print(ans1+" kk")
     l6=tk.Label(mw3,text="",bg='deepskyblue2')
     l6.config(height=10,width=500)
     l6.place(x=150,y=320)
     l4=tk.Label(mw3,text=ans1,font=('Helvetica',20),bg='plum3')
     l4.place(x=150,y=320)
     l5=tk.Label(mw3,text=ans2,font=('Helvetica',20),bg='plum3')
     l5.place(x=150,y=370)
     print(ans1,ans2)
    def main_pro(self):

        reload(project)
        project.main()
        self.file_open()
Esempio n. 14
0
        for mode in modes:
            for threshold in thresholds:
                if (mode == "intrain" and threshold == 0):
                    continue

                print(
                    "\n\n=================== * === * === * ======================"
                )
                print("Calling with: " + arch + " " + str(threshold) + " " +
                      algo + " " + mode + "\n")

                # INCASE OF POSTTRAIN, we don't need to train the model over and over again:
                if (not (mode == 'posttrain' and threshold != 0)):
                    modelCopy = copy.deepcopy(model)

                TrainingAccuracies, sparselevel, testaccuracy = project.main(
                    modelCopy, algo, mode, threshold)

                print(
                    "====================== * === * === * =======================\n\n"
                )

                results.save(arch, algo, mode, threshold, sparselevel,
                             testaccuracy, TrainingAccuracies)

                f = open('outputData.json', 'w')
                f.write(str(results.resultsData))
                f.close()

                pickle.dump(results.resultsData,
                            open('outputPickleData.p', "wb"))
Esempio n. 15
0
def index():
    global firstTime
    if firstTime:
        print(model_firsttime.main())
        firstTime = False
    return render_template('index.html')
Esempio n. 16
0
import project

if __name__ == '__main__':
    project.main()
Esempio n. 17
0
from project import main

if __name__ == '__main__':
    main()
Esempio n. 18
0
from imgtec.console import *
import imgtec.codescape
from imgtec.test import *
import project


@test.suiteSetUp
def suiteSetUp():
    project.start()


@test.suiteTearDown
def suiteTearDown():
    project.stop()


@test
def test0():
    res = project.load()
    devs = res["targets"]
    go(quiet, devices=devs)
    project.waitforhalt(1800, all, probe().socs[0])
    if regs("a0") != 0:
        fail()


if imgtec.codescape.environment == "standalone":
    sys.exit(project.main())
else:
    project.load(rsts, ldrs)
Esempio n. 19
0
import project as project

with open("num_tests.txt", "r") as file:
    number = int(file.readline())
for i in range(number):
    arrival_name = "arrival_" + str(i + 1) + ".txt"
    service_name = "service_" + str(i + 1) + ".txt"
    para_name = "para_" + str(i + 1) + ".txt"
    mode_name = "mode_" + str(i + 1) + ".txt"
    project.main(arrival_name, service_name, para_name, mode_name, i + 1)
Esempio n. 20
0
 def test_no_action(self):
     data = ["./test_data/test1.xlsx"]
     with self.assertRaises(SystemExit) as cm:
         args = self.parser.parse_args(data)
         project.main(args)
     self.assertEqual(cm.exception.code, 'No action specified')
Esempio n. 21
0
 def setUp(self):
     from project import main
     app = main({})
     from webtest import TestApp
     self.testapp = TestApp(app)
Esempio n. 22
0
#!/usr/bin/env python3
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from project import main

if __name__ == '__main__':
    port = 8080
    server = make_server('0.0.0.0', port, main())
    print('will now serve on port ', port)
    server.serve_forever()