def keytest2(self, x):
     self.failIf(x <= 0)
     name = es.keypgetname(x)
     self.failIf(name != "justice")
     es.keypsetname(x, "justice2")
     name = es.keypgetname(x)
     self.failIf(name != "justice2")
     y = es.keypfindsubkey(x, "subkey", False)
     self.failUnless(y is None)
     y = es.keypfindsubkey(x, "subkey", True)
     subname = es.keypgetname(y)
     self.failUnless(subname == "subkey")
     r = es.keypfindsubkey(x, "subkey", True)
     self.failUnless(r == y)
     q = es.keypfindsubkey(x, "subkey2", True)
     subname = es.keypgetname(q)
     self.failIf(subname != "subkey2")
     w = es.keypfindsubkey(x, "subkey3", True)
     e = es.keypfindsubkey(x, "subkey3", True)
     p = es.keypgetfirstsubkey(x)
     n = 0
     while p:
         n += 1
         p = es.keypgetnextkey(p)
     self.failUnless(n == 3)
     self.failUnless(w == e)
     es.keypdetachsubkey(x, w)
     e = es.keypfindsubkey(x, "subkey3", False)
     self.failUnless(e is None)
     es.keypdelete(w)
     p = es.keypgetfirstsubkey(x)
     n = 0
     while p:
         n += 1
         p = es.keypgetnextkey(p)
     self.failUnless(n == 2)
     self.failUnless(es.keypisempty(r))
     # setstring
     es.keypsetstring(r, "hello", "1.3")
     self.failIf(es.keypisempty(r))
     outcome = es.keypgetstring(y, "hello")
     self.failUnless(outcome == "1.3")
     outcome = es.keypgetint(y, "hello")
     self.failUnless(outcome == 1)
     outcome = es.keypgetfloat(y, "hello")
     self.failUnless(round(outcome, 1) == 1.3)
     # setint
     es.keypsetint(y, "hello", 99)
     outcome = es.keypgetint(y, "hello")
     self.failUnless(outcome == 99)
     # setfloat
     es.keypsetint(y, "hello", 99)
     outcome = es.keypgetint(y, "hello")
     self.failUnless(outcome == 99)
     # save to file
     es.keypsavetofile(
         x, server_var['eventscripts_addondir'] + "/pyunittest/myfile.vdf")
Beispiel #2
0
 def keytest2(self, x):
     self.failIf(x <= 0)
     name = es.keypgetname(x)
     self.failIf(name != "justice")
     es.keypsetname(x, "justice2")
     name = es.keypgetname(x)
     self.failIf(name != "justice2")
     y = es.keypfindsubkey(x, "subkey", False)
     self.failUnless(y is None)
     y = es.keypfindsubkey(x, "subkey", True)
     subname = es.keypgetname(y)
     self.failUnless(subname == "subkey")
     r = es.keypfindsubkey(x, "subkey", True)
     self.failUnless(r==y)
     q = es.keypfindsubkey(x, "subkey2", True)
     subname = es.keypgetname(q)
     self.failIf(subname != "subkey2")
     w = es.keypfindsubkey(x, "subkey3", True)
     e = es.keypfindsubkey(x, "subkey3", True)
     p = es.keypgetfirstsubkey(x)
     n = 0
     while p:
       n+=1
       p = es.keypgetnextkey(p)
     self.failUnless(n==3)
     self.failUnless(w==e)
     es.keypdetachsubkey(x, w)
     e = es.keypfindsubkey(x, "subkey3", False)
     self.failUnless(e is None)
     es.keypdelete(w)
     p = es.keypgetfirstsubkey(x)
     n = 0
     while p:
       n+=1
       p = es.keypgetnextkey(p)
     self.failUnless(n==2)
     self.failUnless(es.keypisempty(r))
     # setstring    
     es.keypsetstring(r, "hello", "1.3")
     self.failIf(es.keypisempty(r))
     outcome = es.keypgetstring(y, "hello")
     self.failUnless(outcome=="1.3")
     outcome = es.keypgetint(y, "hello")
     self.failUnless(outcome == 1)
     outcome = es.keypgetfloat(y, "hello")
     self.failUnless(round(outcome,1) == 1.3)
     # setint
     es.keypsetint(y, "hello", 99)
     outcome = es.keypgetint(y, "hello")
     self.failUnless(outcome==99)
     # setfloat
     es.keypsetint(y, "hello", 99)
     outcome = es.keypgetint(y, "hello")
     self.failUnless(outcome==99)
     # save to file
     es.keypsavetofile(x, server_var['eventscripts_addondir'] + "/pyunittest/myfile.vdf")
Beispiel #3
0
 def keytest3(self,x):
     es.keyploadfromfile(x, server_var['eventscripts_addondir'] + "/pyunittest/myfile.vdf")
     y = es.keypfindsubkey(x, "subkey", False)
     outcome = es.keypgetint(y, "hello")
     self.failUnless(outcome==99)
     z = es.keypfindsubkey(y, "test", True)
     name = es.keypgetname(z)
     self.failUnless(name =="test")
     pp = es.keypcreate()
     es.keyploadfromfile(pp, server_var['eventscripts_addondir'] + "/pyunittest/myfile.vdf")
     es.keyprecursivekeycopy(z, pp)
     name = es.keypgetname(z)
     self.failUnless(name == "justice2")
 def keytest3(self, x):
     es.keyploadfromfile(
         x, server_var['eventscripts_addondir'] + "/pyunittest/myfile.vdf")
     y = es.keypfindsubkey(x, "subkey", False)
     outcome = es.keypgetint(y, "hello")
     self.failUnless(outcome == 99)
     z = es.keypfindsubkey(y, "test", True)
     name = es.keypgetname(z)
     self.failUnless(name == "test")
     pp = es.keypcreate()
     es.keyploadfromfile(
         pp, server_var['eventscripts_addondir'] + "/pyunittest/myfile.vdf")
     es.keyprecursivekeycopy(z, pp)
     name = es.keypgetname(z)
     self.failUnless(name == "justice2")
Beispiel #5
0
 def getName(self):
     return es.keypgetname(self._id_)
Beispiel #6
0
 def __str__(self):
     return es.keypgetname(self._id_)
 def getName(self):
     return es.keypgetname(self._id_)
 def __str__(self):
     return es.keypgetname(self._id_)