Esempio n. 1
0
 def test_rotate(self):
     q = Queue()
     for i in range (5):
         q.enqueue(i)
     data = rotate(q, 3)
     res = [3, 4, 0, 1, 2]
     self.assertEqual( (data), res)
Esempio n. 2
0
def test_snap_rotate():
    main.rotate("testpool/dataset1")
Esempio n. 3
0
def month_to_time(month):
    if (month == 1):
        #"January"
        dt = datetime.datetime.today()
        hour = dt.time().strftime('%H:%M:%S')
        print(hour)
        if (hour == '20:03:00'):
            import main1
            print("make door go down")
            try:
                main1.rotate(10)  #going down
            except KeyboardInterrupt:
                main1.p1.stop()
                main1.p2.stop()
                GPIO.cleanup()

        elif (hour == '06:30:00'):
            print("make door go up")
            try:
                main1.rotate(10)  #going up
            except KeyboardInterrupt:
                main1.p1.stop()
                main1.p2.sto()
                GPIO.cleanup()
        else:
            print("do nothing")
            print("\n     __//")
            print("    /.__.\\")
            print("    \ \\/ /")
            print(" '__/   \\")
            print("  \\-      )")
            print("   \\_____/")
            print("_____|_|_____")
            print('     " " ')

    elif (month == 2):
        #Feb
        if (hour == '06:30:00'):
            print('make door go up')
            import main
            main.rotate(0)  #going up

        elif (hour == '18:30:00'):
            print("make door go down")
            import main
            main.rotate(10)
        else:
            print('do nothing')

    elif (month == 3):
        #March
        if (hour == '18:30:00'):
            print("make door go up")
        elif (hour == '19:30:00'):
            print('make door go won')
        else:
            print("do nothing")

    elif (month == 4):
        #April
        if (hour == '18:30:00'):
            print('make door go up')
        elif (hour == '19:30:00'):
            print('make door go down')
        else:
            print('do nothing')

    elif (month == 5):
        #May
        if (hour == '18:30:00'):
            print('make door go up')
        elif (hour == '19:30:00'):
            print('make door go down')
        else:
            print('do nothing')

    elif (month == 6):
        #June
        if (hour == '18:30:00'):
            print('make door go up')
        elif (hour == '19:30:00'):
            print('make door go down')
        else:
            print('do nothing')

    elif (month == 7):
        #July
        if (hour == '18:30:00'):
            print('make door go up')
        elif (hour == '19:30:00'):
            print('make door go down')
        else:
            print('do nothing')

    elif (month == 8):
        #August
        if (hour == '18:30:00'):
            print('make door go up')
        elif (hour == '19:30:00'):
            print('make door go down')
        else:
            print('do nothing')

    elif (month == 9):
        #September
        if (hour == '18:30:00'):
            print('make door go up')
        elif (hour == '19:30:00'):
            print('make door go down')
        else:
            print('do nothing')

    elif (month == 10):
        #October
        if (hour == '18:30:0'):
            print('make door go up')
        elif (hour == '19:30:00'):
            print('make door go down')
        else:
            print('do nothing')

    elif (month == 11):
        #November
        if (hour == '18:30:00'):
            print('make door go up')
        elif (hour == '19:30:00'):
            print('make door down')
        else:
            print('do nothing')

    elif (month == 12):
        #December
        if (hour == '18:30:00'):
            print('make door go up')
        elif (hour == '19:30:00'):
            print('make door go down')
        else:
            print('do nothing')
Esempio n. 4
0
 def test_rotate(self):
     self.assertEqual('v', main.rotate('q', 343))
Esempio n. 5
0
 def up_test(self):
     self.assertEqual(90, rotate([0, 1]))
Esempio n. 6
0
 def test(self):
     self.assertEqual(0, rotate([0, 0]))
Esempio n. 7
0
 def left_test(self):
     self.assertEqual(180, rotate([-1, 0]))
Esempio n. 8
0
 def down_test(self):
     self.assertEqual(-90, rotate([0, -1]))
Esempio n. 9
0
 def right_test(self):
     self.assertEqual(0, rotate([1, 0]))
Esempio n. 10
0
 def test(self):
     self.assertEqual(main.rotate([1, 2, 3, 4, 5, 6], 3), [4, 5, 6, 1, 2, 3])
     self.assertEqual(main.rotate([1, 2, 3, 4, 5, 6], -2), [5, 6, 1, 2, 3, 4])