def test_stringBufferRevertsToActualValues(self): fmt, buf, xmlFile = go.gen_starburst_sf(self.data, True) dict, version = self.xml_ptrs(xmlFile) # Test the LO/Noise Module values testDic = dict["Starburst"]["LONM"] for key, value in testDic.items(): if key == "Name": val1 = self.extract(buf, value) val1 = val1.replace('\x00', '') val2 = self.data['starburst']["LONOISE"][self.nameMap[key]] self.assertEqual(val1, val2) elif key == "LOFrequency": val1 = self.extract(buf, value) val2 = self.data['starburst']["LONOISE"][self.nameMap[key]][1] self.assertEqual(val1, val2) else: val1 = self.extract(buf, value) val2 = self.data['starburst']["LONOISE"][self.nameMap[key]] self.assertEqual(val1, val2) # Test the AntennaA Module values testDic = dict["Starburst"]["DCMA"] for key, value in testDic.items(): if key == "Name": val1 = self.extract(buf, value) val1 = val1.replace('\x00', '') val2 = self.data['starburst']["A"][self.nameMap[key]] self.assertEqual(val1, val2) else: val1 = self.extract(buf, value) val2 = self.data['starburst']["A"][self.nameMap[key]] self.assertEqual(val1, val2) # Test the AntennaB Module values testDic = dict["Starburst"]["DCMB"] for key, value in testDic.items(): if key == "Name": val1 = self.extract(buf, value) val1 = val1.replace('\x00', '') val2 = self.data['starburst']["B"][self.nameMap[key]] self.assertEqual(val1, val2) else: val1 = self.extract(buf, value) val2 = self.data['starburst']["B"][self.nameMap[key]] self.assertEqual(val1, val2)
def test_sensibleEvenIfDictionaryIsEmpty(self): fmt, buf, xmlFile = go.gen_starburst_sf({}) self.assertTrue(sys.getsizeof(buf) != 0)
def test_XMLFileIsGenerated(self): fmt, buf, xmlFile = go.gen_starburst_sf(self.data, True) self.assertTrue(os.path.exists(xmlFile))