Beispiel #1
0
class TestGeneral(unittest.TestCase):
    def setUp(self):  #run before each test
        self.SMW = VSG()
        try:
            self.SMW.jav_Open(host, prnt=0)
            self.SMW.jav_Reset()
            self.SMW.jav_ClrErr()
            self.SMW.dLastErr = ""
        except:
            self.assertTrue(1)

    def tearDown(self):  #Run after each test
        self.SMW.jav_Close()

###############################################################################
### <Test>
###############################################################################

    def test_SMW_Connect(self):
        self.SMW.jav_IDN(prnt=0)
        self.assertEqual(self.SMW.Make, "Rohde&Schwarz")

    def test_SMW_Freq(self):
        frq = 1e6
        self.SMW.Set_Freq(frq)
        rdFrq = self.SMW.Get_Freq()
        self.assertEqual(self.SMW.jav_Error()[0], '0')
        self.assertEqual(frq, rdFrq)

    def test_SMW_Pwr(self):
        pwr = -10
        self.SMW.Set_RFPwr(pwr)
        rdPwr = self.SMW.Get_PowerRMS()
        self.assertEqual(self.SMW.jav_Error()[0], '0')
        self.assertEqual(pwr, rdPwr)
Beispiel #2
0
class TestGeneral(unittest.TestCase):
   def setUp(self):                 #run before each test
      self.SMW = VSG()
      try:
         self.SMW.jav_Open(host)
         self.SMW.jav_Reset()
         self.SMW.jav_ClrErr()
         self.SMW.dLastErr = ""
      except:
         self.assertTrue(1)

   def test_SMW_Connect(self):
      self.assertEqual(self.SMW.jav_Error()[0],'0')

   def test_SMW_Common(self):      
      self.SMW.Set_Freq(1e6)
      self.SMW.Set_Power(10)
      self.SMW.Get_Freq()
      self.SMW.Get_Level()
      self.assertEqual(self.SMW.jav_Error()[0],'0')