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)
def test_menuItemsAreList( self ): asserts( self, Form, 3 , lambda x:x ) asserts( self, Form, "" , lambda x:x ) Form( [""], lambda x: x)
def test_addClientNoDuplicates( self ): self.tracker.addClient( 0 ) asserts( self, self.tracker.addClient, 0 )
def test_removeClientIsInt(self): asserts(self, self.tracker.removeClient, None) asserts(self, self.tracker.removeClient, "foo")
def test_getSessionFactoryParamsNotString(self): asserts(self, db.getSessionFactory, 3, None, None) asserts(self, db.getSessionFactory, "", 3, None)
def test_prefixNotString(self): asserts(self, db.data.setPrefix, None) asserts(self, db.data.setPrefix, 12)
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)
def test_menuItemsAreList(self): asserts(self, Form, 3, lambda x: x) asserts(self, Form, "", lambda x: x) Form([""], lambda x: x)
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)
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) ] , "")
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 )
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 )
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 )
def test_menuItemsTuplesOrStrings( self ): asserts( self, Form, [0 ] , lambda x:x) asserts( self, Form, ["",("",lambda x:x, lambda y:y),7 ] , lambda x:x)
def test_selectionCallbackIsFunc( self ): asserts( self, ValueSelector, [""] , 0 ) asserts( self, ValueSelector, [""] , None ) ValueSelector( [""], lambda x: x )
def test_alphabeticOptionsIsBool( self ): asserts( self, ValueSelector, [""] , lambda x: x, lambda x:x, 0 ) ValueSelector( [""], lambda x: x, lambda x: x, True )
def test_alphabeticOptionsIsBool( self ): asserts( self, Form, [""] , lambda x: x, lambda x:x, 0 ) Form( [""], lambda x: x, lambda x: x, True )
def test_prefixNotString(self): asserts( self, db.data.setPrefix, None) asserts( self, db.data.setPrefix, 12)
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, "" )
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)
def test_typeDuplicate(self): db.data.setType( "abc", "" ) asserts( self, db.data.setType, "abc", "jim" )
def test_typeDuplicate(self): db.data.setType("abc", "") asserts(self, db.data.setType, "abc", "jim")
def test_typeDistinctValues(self): db.data.setType( "abc", "def" ) asserts( self, db.data.setType, "def", "def" )
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)
def test_getSessionFactoryParamsNotString(self): asserts( self, db.getSessionFactory, 3, None, None ) asserts( self, db.getSessionFactory, "", 3, None )
def test_isClientIsInt(self): asserts(self, self.tracker.isClient, None) asserts(self, self.tracker.isClient, "foo") self.tracker.isClient(0)
def test_getSessionFactoryBaseNone(self): asserts( self, db.getSessionFactory, "", "", None )
def test_removeClientMustExist( self ): asserts( self, self.tracker.removeClient, 0 )
def test_promptPopNPositive( self ): asserts( self, self.prompt.popPrompt, -1 ) asserts( self, self.prompt.popPrompt, 0 )
def test_menuItemsTuplesArePairs( self ): asserts( self, ValueSelector, [("",5,5) ] , lambda clientId, selectedValue: None ) asserts( self, ValueSelector, ["foo", ("",3,8) ] , lambda clientId, selectedValue: None )
def test_promptPushRequiresFunc( self ): asserts( self, self.prompt.pushPrompt, 0 ) asserts( self, self.prompt.pushPrompt, None ) self.prompt.pushPrompt( lambda x: x )
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 )
def test_promptPopRequiresInt( self ): asserts( self, self.prompt.popPrompt, "foo" ) asserts( self, self.prompt.popPrompt, None ) self.prompt.popPrompt( 5 )
def test_noEmptyForm(self): asserts(self, Form, [], lambda x: None)
def test_promptClientIsInt( self ): asserts( self, prompt.prompt, "foo", None )
def test_menuItemsTuplesOrStrings(self): asserts(self, Form, [0], lambda x: x) asserts(self, Form, ["", ("", lambda x: x, lambda y: y), 7], lambda x: x)
def test_promptClientExists( self ): asserts( self, prompt.prompt, 5, None ) prompt.tracker.addClient( 8 ) prompt.prompt( 8, None )
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)
def test_pushClientIsInt( self ): asserts( self, prompt.pushPrompt, "foo", lambda x: x )
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)], "")
def test_pushClientExists( self ): asserts( self, prompt.pushPrompt, 5, lambda x: x ) prompt.tracker.addClient( 8 ) prompt.pushPrompt( 8, lambda x: x )
def test_alphabeticOptionsIsBool(self): asserts(self, Form, [""], lambda x: x, lambda x: x, 0) Form([""], lambda x: x, lambda x: x, True)
def test_popClientIsInt( self ): asserts( self, prompt.popPrompt, "foo", 5 )
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, "")
def test_popClientExists( self ): asserts( self, prompt.pushPrompt, 5, 2 ) prompt.tracker.addClient( 8 ) prompt.popPrompt( 8, 7 )
def test_typeDistinctValues(self): db.data.setType("abc", "def") asserts(self, db.data.setType, "def", "def")
def test_popClientIsInt(self): asserts(self, prompt.popPrompt, "foo", 5)
def test_getSessionFactoryBaseNone(self): asserts(self, db.getSessionFactory, "", "", None)
def test_popClientExists(self): asserts(self, prompt.pushPrompt, 5, 2) prompt.tracker.addClient(8) prompt.popPrompt(8, 7)
def test_addClientNoDuplicates(self): self.tracker.addClient(0) asserts(self, self.tracker.addClient, 0)
def test_noEmptyMenu( self ): asserts( self, ValueSelector, [] , lambda clientId, selectedValue: None )
def test_removeClientMustExist(self): asserts(self, self.tracker.removeClient, 0)
def test_menuItemsAreList( self ): asserts( self, ValueSelector, 3 , lambda clientId, selectedValue: None ) asserts( self, ValueSelector, "" , lambda clientId, selectedValue: None ) ValueSelector( [""], lambda x: x)
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 )
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 )
def test_removeClientIsInt(self): asserts( self, self.tracker.removeClient, None ) asserts( self, self.tracker.removeClient, "foo" )
def test_menuItemsTuplesOrStrings( self ): asserts( self, ValueSelector, [0 ] , lambda clientId, selectedValue: None ) asserts( self, ValueSelector, ["",("",5),7 ] , lambda clientId, selectedValue: None )
def test_isClientIsInt(self): asserts( self, self.tracker.isClient, None ) asserts( self, self.tracker.isClient, "foo" ) self.tracker.isClient( 0 )
def test_noEmptyForm( self ): asserts( self, Form, [], lambda x: None )