Beispiel #1
0
 def test_constant(self):
     testdict = {"Test1" : "Test", "Test2" : "Test", "Test3" : 3}
     cls = InfoGroup()
     for key, value in testdict.items():
         cls.const(key, value)
     cls.generate()
     cls.update()
     outdict = cls.get()
     for key in testdict:
         self.assertEqual(testdict[key], outdict[key])
Beispiel #2
0
 def test_files(self):
     resdict = {"File{}".format(x) : "File{}".format(x) for x in range(4)}
     cls = InfoGroup()
     for tkey in self.temp_files:
         _, tfname = self.temp_files[tkey]
         cls.addf(tkey, tfname)
     cls.generate()
     cls.update()
     outdict = cls.get()
     for i,tkey in enumerate(resdict):
         self.assertEqual(resdict[tkey], outdict[tkey])
Beispiel #3
0
 def test_filesMatchConvert(self):
     resdict = {"File{}".format(x) : x for x in range(4)}
     match = r"File(\d+)"
     cls = InfoGroup()
     for tkey in self.temp_files:
         _, tfname = self.temp_files[tkey]
         cls.addf(tkey, tfname, match, int)
     cls.generate()
     cls.update()
     outdict = cls.get()
     for i,tkey in enumerate(resdict):
         self.assertEqual(resdict[tkey], outdict[tkey])
Beispiel #4
0
 def test_commandsMatch(self):
     resdict = {"File{}".format(x) : "{}".format(x) for x in range(4)}
     match = r"File(\d+)"
     cls = InfoGroup()
     for tkey in self.temp_files:
         _, tfname = self.temp_files[tkey]
         cls.addc(tkey, "echo", "{}".format(tkey), match)
     cls.generate()
     cls.update()
     outdict = cls.get()
     for i,tkey in enumerate(resdict):
         self.assertEqual(resdict[tkey], outdict[tkey])
Beispiel #5
0
 def test_empty(self):
     cls = InfoGroup()
     self.assertEqual(cls.name, None)
     self.assertEqual(cls.extended, False)
     self.assertEqual(cls.anonymous, False)
     self.assertEqual(cls.files, {})
     self.assertEqual(cls.commands, {})
     self.assertEqual(cls.constants, {})
     self.assertEqual(cls._instances, [])
Beispiel #6
0
 def test_anonymous(self):
     cls = InfoGroup(anonymous=True)
     self.assertEqual(cls.anonymous, True)
Beispiel #7
0
 def test_extended(self):
     cls = InfoGroup(extended=True)
     self.assertEqual(cls.extended, True)
Beispiel #8
0
 def test_named(self):
     cls = InfoGroup(name="Testname")
     self.assertEqual(cls.name, "Testname")