示例#1
0
 def test_menuItemDescsAreStrings(self):
     asserts(self, Form, [(37, lambda x: x, lambda x: x)],
             lambda clientId, selectedValue: None)
     asserts(self, Form, [(None, lambda x: x, lambda x: x)],
             lambda clientId, selectedValue: None)
     asserts(self, Form, [(lambda x: x, lambda x: x, lambda x: x)],
             lambda clientId, selectedValue: None)
示例#2
0
 def test_menuItemsAreList( self ):
     asserts( self, Form, 3 , lambda x:x )
     asserts( self, Form, "" , lambda x:x )
     Form( [""], lambda x: x)
示例#3
0
 def test_addClientNoDuplicates( self ):
     self.tracker.addClient( 0 )
     asserts( self, self.tracker.addClient, 0 )
示例#4
0
 def test_removeClientIsInt(self):
     asserts(self, self.tracker.removeClient, None)
     asserts(self, self.tracker.removeClient, "foo")
示例#5
0
 def test_getSessionFactoryParamsNotString(self):
     asserts(self, db.getSessionFactory, 3, None, None)
     asserts(self, db.getSessionFactory, "", 3, None)
示例#6
0
 def test_prefixNotString(self):
     asserts(self, db.data.setPrefix, None)
     asserts(self, db.data.setPrefix, 12)
示例#7
0
 def test_menuItemValueDescFuncIsFunc(self):
     asserts(self, Form, [("", lambda x: x, 37)],
             lambda clientId, selectedValue: None)
     asserts(self, Form, [("", lambda x: x, "")],
             lambda clientId, selectedValue: None)
示例#8
0
 def test_menuItemsAreList(self):
     asserts(self, Form, 3, lambda x: x)
     asserts(self, Form, "", lambda x: x)
     Form([""], lambda x: x)
示例#9
0
 def test_invalidSelectionCallbackIsFuncOrNone( self ):
     asserts( self, Form, [("", lambda x:x,lambda x:x) ] , lambda x:x, 0 )
     asserts( self, Form, [("", lambda x:x,lambda x:x) ] , lambda x:x, "" )
     Form( [""], lambda x: x, lambda x: x)
     Form( [""], lambda x: x, None)
示例#10
0
 def test_submitCallbackIsFunc( self ):
     asserts( self, Form, [("", lambda x:x,lambda x:x) ] , 5 )
     asserts( self, Form, [("", lambda x:x,lambda x:x) ] , None )
     asserts( self, Form, [("", lambda x:x,lambda x:x) ] , "")
示例#11
0
 def test_menuItemValueDescFuncIsFunc( self ):
     asserts( self, Form, [("", lambda x:x,37) ] , lambda clientId, selectedValue: None )
     asserts( self, Form, [("", lambda x:x,"") ] , lambda clientId, selectedValue: None )
示例#12
0
 def test_menuItemSelectedFuncIsFunc( self ):
     asserts( self, Form, [("",37, lambda x:x) ] , lambda clientId, selectedValue: None )
     asserts( self, Form, [("","",lambda x:x) ] , lambda clientId, selectedValue: None )
示例#13
0
 def test_menuItemDescsAreStrings( self ):
     asserts( self, Form, [(37,lambda x:x, lambda x:x) ] , lambda clientId, selectedValue: None )
     asserts( self, Form, [(None,lambda x:x,lambda x:x) ] , lambda clientId, selectedValue: None )
     asserts( self, Form, [(lambda x: x,lambda x:x,lambda x:x) ] , lambda clientId, selectedValue: None )
示例#14
0
 def test_menuItemsTuplesOrStrings( self ):
     asserts( self, Form, [0 ] , lambda x:x)
     asserts( self, Form, ["",("",lambda x:x, lambda y:y),7 ] , lambda x:x)
示例#15
0
 def test_selectionCallbackIsFunc( self ):
     asserts( self, ValueSelector, [""] , 0 )
     asserts( self, ValueSelector, [""] , None )
     ValueSelector( [""], lambda x: x )
示例#16
0
 def test_alphabeticOptionsIsBool( self ):
     asserts( self, ValueSelector, [""] , lambda x: x, lambda x:x, 0 )
     ValueSelector( [""], lambda x: x, lambda x: x, True )
示例#17
0
 def test_alphabeticOptionsIsBool( self ):
     asserts( self, Form, [""] , lambda x: x, lambda x:x, 0 )
     Form( [""], lambda x: x, lambda x: x, True )
示例#18
0
 def test_prefixNotString(self):
     asserts( self, db.data.setPrefix, None)
     asserts( self, db.data.setPrefix, 12)
示例#19
0
 def test_typeNotString(self):
     asserts( self, db.data.setType, None, None )
     asserts( self, db.data.setType, 12, None )
     asserts( self, db.data.setType, "", None )
     asserts( self, db.data.setType, 7, "" )
示例#20
0
 def test_invalidSelectionCallbackIsFuncOrNone(self):
     asserts(self, Form, [("", lambda x: x, lambda x: x)], lambda x: x, 0)
     asserts(self, Form, [("", lambda x: x, lambda x: x)], lambda x: x, "")
     Form([""], lambda x: x, lambda x: x)
     Form([""], lambda x: x, None)
示例#21
0
 def test_typeDuplicate(self):
     db.data.setType( "abc", "" )
     asserts( self, db.data.setType, "abc", "jim" )
示例#22
0
 def test_typeDuplicate(self):
     db.data.setType("abc", "")
     asserts(self, db.data.setType, "abc", "jim")
示例#23
0
 def test_typeDistinctValues(self):
     db.data.setType( "abc", "def" )
     asserts( self, db.data.setType, "def", "def" )
示例#24
0
 def test_initAddFuncIsCallable(self):
     asserts(self, clientTracker.ClientTracker, None)
     asserts(self, clientTracker.ClientTracker, 12)
     self.assert_(
         clientTracker.ClientTracker(lambda x: 5).addFunc(None) == 5)
     clientTracker.ClientTracker(Foo)
示例#25
0
 def test_getSessionFactoryParamsNotString(self):
     asserts( self, db.getSessionFactory, 3, None, None )
     asserts( self, db.getSessionFactory, "", 3, None )
示例#26
0
 def test_isClientIsInt(self):
     asserts(self, self.tracker.isClient, None)
     asserts(self, self.tracker.isClient, "foo")
     self.tracker.isClient(0)
示例#27
0
 def test_getSessionFactoryBaseNone(self):
     asserts( self, db.getSessionFactory, "", "", None )
示例#28
0
 def test_removeClientMustExist( self ):
     asserts( self, self.tracker.removeClient, 0 )
示例#29
0
 def test_promptPopNPositive( self ):
     asserts( self, self.prompt.popPrompt, -1 )
     asserts( self, self.prompt.popPrompt, 0 )
示例#30
0
 def test_menuItemsTuplesArePairs( self ):
     asserts( self, ValueSelector, [("",5,5) ] , lambda clientId, selectedValue: None )
     asserts( self, ValueSelector, ["foo", ("",3,8) ] , lambda clientId, selectedValue: None )
示例#31
0
 def test_promptPushRequiresFunc( self ):
     asserts( self, self.prompt.pushPrompt, 0 )
     asserts( self, self.prompt.pushPrompt, None )
     self.prompt.pushPrompt( lambda x: x )
示例#32
0
 def test_invalidSelectionCallbackIsFunc( self ):
     asserts( self, ValueSelector, [""] , lambda x: x, 0 )
     asserts( self, ValueSelector, [""] , lambda x: x, "foo" )
     ValueSelector( [""], lambda x: x, lambda x: x )
示例#33
0
 def test_promptPopRequiresInt( self ):
     asserts( self, self.prompt.popPrompt, "foo" )
     asserts( self, self.prompt.popPrompt, None )
     self.prompt.popPrompt( 5 )
示例#34
0
 def test_noEmptyForm(self):
     asserts(self, Form, [], lambda x: None)
示例#35
0
 def test_promptClientIsInt( self ):
     asserts( self, prompt.prompt, "foo", None )
示例#36
0
 def test_menuItemsTuplesOrStrings(self):
     asserts(self, Form, [0], lambda x: x)
     asserts(self, Form, ["", ("", lambda x: x, lambda y: y), 7],
             lambda x: x)
示例#37
0
 def test_promptClientExists( self ):
     asserts( self, prompt.prompt, 5, None )
     prompt.tracker.addClient( 8 )
     prompt.prompt( 8, None )
示例#38
0
 def test_menuItemSelectedFuncIsFunc(self):
     asserts(self, Form, [("", 37, lambda x: x)],
             lambda clientId, selectedValue: None)
     asserts(self, Form, [("", "", lambda x: x)],
             lambda clientId, selectedValue: None)
示例#39
0
 def test_pushClientIsInt( self ):
     asserts( self, prompt.pushPrompt, "foo", lambda x: x )
示例#40
0
 def test_submitCallbackIsFunc(self):
     asserts(self, Form, [("", lambda x: x, lambda x: x)], 5)
     asserts(self, Form, [("", lambda x: x, lambda x: x)], None)
     asserts(self, Form, [("", lambda x: x, lambda x: x)], "")
示例#41
0
 def test_pushClientExists( self ):
     asserts( self, prompt.pushPrompt, 5, lambda x: x )
     prompt.tracker.addClient( 8 )
     prompt.pushPrompt( 8, lambda x: x )
示例#42
0
 def test_alphabeticOptionsIsBool(self):
     asserts(self, Form, [""], lambda x: x, lambda x: x, 0)
     Form([""], lambda x: x, lambda x: x, True)
示例#43
0
 def test_popClientIsInt( self ):
     asserts( self, prompt.popPrompt, "foo", 5 )
示例#44
0
 def test_typeNotString(self):
     asserts(self, db.data.setType, None, None)
     asserts(self, db.data.setType, 12, None)
     asserts(self, db.data.setType, "", None)
     asserts(self, db.data.setType, 7, "")
示例#45
0
 def test_popClientExists( self ):
     asserts( self, prompt.pushPrompt, 5, 2 )
     prompt.tracker.addClient( 8 )
     prompt.popPrompt( 8, 7 )
示例#46
0
 def test_typeDistinctValues(self):
     db.data.setType("abc", "def")
     asserts(self, db.data.setType, "def", "def")
示例#47
0
 def test_popClientIsInt(self):
     asserts(self, prompt.popPrompt, "foo", 5)
示例#48
0
 def test_getSessionFactoryBaseNone(self):
     asserts(self, db.getSessionFactory, "", "", None)
示例#49
0
 def test_popClientExists(self):
     asserts(self, prompt.pushPrompt, 5, 2)
     prompt.tracker.addClient(8)
     prompt.popPrompt(8, 7)
示例#50
0
 def test_addClientNoDuplicates(self):
     self.tracker.addClient(0)
     asserts(self, self.tracker.addClient, 0)
示例#51
0
 def test_noEmptyMenu( self ):
     asserts( self, ValueSelector, [] , lambda clientId, selectedValue: None )
示例#52
0
 def test_removeClientMustExist(self):
     asserts(self, self.tracker.removeClient, 0)
示例#53
0
 def test_menuItemsAreList( self ):
     asserts( self, ValueSelector, 3 , lambda clientId, selectedValue: None )
     asserts( self, ValueSelector, "" , lambda clientId, selectedValue: None )
     ValueSelector( [""], lambda x: x)
示例#54
0
 def test_initAddFuncIsCallable(self):
     asserts( self, clientTracker.ClientTracker, None)
     asserts( self, clientTracker.ClientTracker, 12)
     self.assert_( clientTracker.ClientTracker( lambda x: 5 ).addFunc( None ) == 5 )
     clientTracker.ClientTracker( Foo )
示例#55
0
 def test_menuItemDescsAreStrings( self ):
     asserts( self, ValueSelector, [(37,0) ] , lambda clientId, selectedValue: None )
     asserts( self, ValueSelector, [(None,0) ] , lambda clientId, selectedValue: None )
     asserts( self, ValueSelector, [(lambda x: x,0) ] , lambda clientId, selectedValue: None )
示例#56
0
 def test_removeClientIsInt(self):
     asserts( self, self.tracker.removeClient, None )
     asserts( self, self.tracker.removeClient, "foo" )
示例#57
0
 def test_menuItemsTuplesOrStrings( self ):
     asserts( self, ValueSelector, [0 ] , lambda clientId, selectedValue: None )
     asserts( self, ValueSelector, ["",("",5),7 ] , lambda clientId, selectedValue: None )
示例#58
0
 def test_isClientIsInt(self):
     asserts( self, self.tracker.isClient, None )
     asserts( self, self.tracker.isClient, "foo" )
     self.tracker.isClient( 0 )
示例#59
0
 def test_noEmptyForm( self ):
     asserts( self, Form, [], lambda x: None )