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)
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
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())
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]
def test_get_machine_schedules(self): self.machine = Machine("tr11") res = self.machine.get_machine_schedule_dictionaries() print("dict") print(res)
def setUp(self): self.machine = Machine("treadmill_test")
def test_init(self): edison = Machine("edison", 24) self.assertEqual(edison._cores_per_node, 24) self.assertEqual(edison._machine_name, "edison")
def setUp(self): unittest.TestCase.setUp(self) self._edison = Machine("edison", 24)
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
def test_is_octet_3(): """ Checks that a string represents an octet """ host = Machine() val = '258' assert not host.is_octet(val)
def test_set_name(): """ Changes the name of the machine """ host = Machine() name = 'hurukan' host.set_name(name) assert host.get_name() == name
def test_get_id(): """ Returns the identity of the machine """ host = Machine() assert host.get_id() == 'Host : localhost 127.0.0.1'