Ejemplo n.º 1
0
 def testConfigParserConstruction(self):
     cfg1 = Config.FRETConfigParser()
     cfg2 = Config.ReconstructionConfigParser()
     cfg3 = Config.BurstDistAVGConfigParser()
     self.assertEqual(cfg1.get("Burst Size Distribution", "method"),
                      "analytical")
     self.assertEqual(cfg2.get("Burst Size Distribution", "method"),
                      "analytical")
     self.assertEqual(cfg3.get("Burst Size Distribution", "method"),
                      "analytical")
Ejemplo n.º 2
0
    def testReadWriteReconstruction(self):
        config1 = Config.ReconstructionConfigParser()
        config2 = Config.ReconstructionConfigParser()
        config3 = Config.ReconstructionConfigParser()

        tf = tempfile.mktemp()
        with open(tf, "w") as tfh:
            config1.write(tfh)
        with open(tf) as tfh2:
            config2.readfp(tfh2)

        config3.read(tf)
Ejemplo n.º 3
0
 def testGetInvalidValue(self):
     config = Config.SecureConfigParser()
     self.assertRaises(ValueError, config.get, "Invalid", "Invalid")
Ejemplo n.º 4
0
 def testSetInvalidValue(self):
     config = Config.SecureConfigParser()
     config.setdefault("Invalid", "Invalid", 1, int, lambda x: x > 0,
                       "must be larger zero")
     self.assertRaises(ValueError, config.set, "Invalid", "Invalid", -1)
Ejemplo n.º 5
0
 def testAddTwice(self):
     config = Config.SecureConfigParser()
     config.setdefault("Invalid", "Invalid", "a", str, lambda x: True,
                       "must be string")
     self.assertRaises(ValueError, config.setdefault, "Invalid", "Invalid",
                       "a", str, lambda x: True, "must be string")
Ejemplo n.º 6
0
 def testAddWithoutDefault(self):
     config = Config.SecureConfigParser()
     self.assertRaises(ValueError, config.set, "Invalid", "Invalid", "a")