예제 #1
0
    def test_get_all(self):
        try:
            self.machine = Machine("treadmill_0")

            ms = self.machine.get_all_machines()
            print(ms)

            self.assertTrue(len(ms) > 0)

        except Exception as e:
            print(e)
예제 #2
0
파일: fsms.py 프로젝트: txt/plm18
def fsm0(label):
    m = Machine(label)
    entry = m.S("entry")  # first names state is "start"
    foo = m.S("foo")
    bar = m.S("bar")
    stop = m.S("stop.")  # anything with a "." is a "stop"
    #-- machine
    m.T(entry, walk, foo)
    m.T(foo, walk, foo)
    m.T(foo, sit, stop)
    return m
예제 #3
0
def main(argv):
    """
    The main program
    """

    try:
        #pylint: disable=unused-variable
        opts, args = getopt.getopt(argv, "h", ["help"])

    except getopt.GetoptError:
        usage()

    #pylint: disable=unused-variable
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()

    print('Testing the machines')
    my_host = Machine()
    my_host.set_name('hurukan')
    my_host.set_ip_nbr('132.166.28.183')

    print(my_host.get_id())
예제 #4
0
from products import Lot
from sites import Site

machines = []
lots = []
sites = []

data = xlrd.open_workbook('machines.xlsx')
num_of_catagories = len(data.sheets())
for i in range(num_of_catagories):
    table = data.sheets()[i]
    num_of_rows = table.nrows
    num_of_cols = table.ncols
    #print(num_of_rows,num_of_cols)
    for i in range(2, num_of_cols):
        machines.append(Machine(table.cell(0, i).value, 0))  #以机器名称实例化Machine
        for j in range(num_of_rows):
            if (table.cell(j, i).value == 'Y'):
                machines[len(machines) - 1].product_push(
                    int(table.cell(j, 0).value), int(table.cell(j, 1).value))
                if (len(machines[-1].all_possible_sites) == 0):
                    machines[len(machines) - 1].all_possible_sites.append(
                        int(table.cell(j, 0).value))
                elif (machines[-1].all_possible_sites[-1] != table.cell(
                        j, 0).value):
                    machines[len(machines) - 1].all_possible_sites.append(
                        int(table.cell(j, 0).value))
        #print(machines[len(machines)-1].name,machines[len(machines)-1].all_possible_sites,machines[len(machines)-1].products)

data = xlrd.open_workbook('overall.xlsx')
table = data.sheets()[1]
예제 #5
0
    def test_get_machine_schedules(self):
        self.machine = Machine("tr11")

        res = self.machine.get_machine_schedule_dictionaries()
        print("dict")
        print(res)
예제 #6
0
 def setUp(self):
     self.machine = Machine("treadmill_test")
예제 #7
0
 def test_init(self):
     edison = Machine("edison", 24)
     self.assertEqual(edison._cores_per_node, 24)
     self.assertEqual(edison._machine_name, "edison")
예제 #8
0
 def setUp(self):
     unittest.TestCase.setUp(self)
     self._edison = Machine("edison", 24)
예제 #9
0
파일: test_machines.py 프로젝트: jplf/jplab
def test_set_ip_nbr():
    """ Sets the ip number of the machine """
    host = Machine()
    ip_nbr = '132.166.28.183'
    host.set_ip_nbr(ip_nbr)
    assert host.get_ip_nbr() == ip_nbr
예제 #10
0
파일: test_machines.py 프로젝트: jplf/jplab
def test_is_octet_3():
    """ Checks that a string represents an octet """
    host = Machine()
    val = '258'
    assert not host.is_octet(val)
예제 #11
0
파일: test_machines.py 프로젝트: jplf/jplab
def test_set_name():
    """ Changes the name of the machine """
    host = Machine()
    name = 'hurukan'
    host.set_name(name)
    assert host.get_name() == name
예제 #12
0
파일: test_machines.py 프로젝트: jplf/jplab
def test_get_id():
    """ Returns the identity of the machine """
    host = Machine()
    assert host.get_id() == 'Host : localhost 127.0.0.1'