Lines Matching refs:self
37 def setUp(self): argument
38 self.pin = m.Gpio(MRAA_GPIO)
39 self.gpio_path = "/sys/class/gpio/gpio" + str(self.pin.getPin(True))
41 def tearDown(self): argument
43 self.pin = ""
45 def test_returning_pin_no(self): argument
46 self.pin_no = self.pin.getPin() # i should have the pin no. here as set when initing Gpio class
47 …self.assertEqual(self.pin_no, MRAA_GPIO, "Something wrong happened ... set pin doesn't correspond …
49 def test_returning_pin_as_on_sys(self): argument
50 self.assertTrue(os.path.exists(self.gpio_path))
52 def test_set_GPIO_as_output(self): argument
53 self.pin.dir(m.DIR_OUT)
54 dir_file = open(self.gpio_path + "/direction")
57 self.assertMultiLineEqual(dir_file_content, "out")
59 def test_set_GPIO_as_input(self): argument
60 self.pin.dir(m.DIR_IN)
61 dir_file = open(self.gpio_path + "/direction")
64 self.assertMultiLineEqual(dir_file_content, "in")
66 def test_GPIO_as_output_write_HIGH_level(self): argument
67 self.pin.dir(m.DIR_OUT)
68 self.pin.write(1)
69 val_file = open(self.gpio_path + "/value")
72 self.assertEqual(int(sysfs_pin_value),1, "Value doesn't match the HIGH state")
74 def test_GPIO_as_output_write_LOW_level(self): argument
75 self.pin.dir(m.DIR_OUT)
76 self.pin.write(0)
77 val_file = open(self.gpio_path + "/value")
80 self.assertEqual(int(sysfs_pin_value), 0, "Value doesn't match the LOW state")
82 def test_GPIO_as_input_and_write_HIGH_on_it(self): argument
83 self.pin.dir(m.DIR_IN)
84 res = self.pin.write(1)
85 self.assertNotEqual(res, m.SUCCESS, "The command should fail")
87 def test_GPIO_as_input_and_write_LOW_on_it(self): argument
88 self.pin.dir(m.DIR_IN)
89 res = self.pin.write(0)
90 self.assertGreater(res, 0, "The command should have returned value greater than 0")