def main(): params = { "server": "mpilgrim", "database": "master", "uid": "sa", "pwd": "secret" } print odbchelper.buildConnectionString(params) print odbchelper.buildConnectionString.__doc__
def testKnownValue(self): """buildConnectionString returns known result with known input""" params = {"server":"mpilgrim", "database":"master", "uid":"sa", "pwd":"secret"} knownItems = params.items() knownItems.sort() knownString = repr(knownItems) result = odbchelper.buildConnectionString(params) resultItems = [tuple(e.split("=")) for e in result.split(";")] resultItems.sort() resultString = repr(resultItems) self.assertEqual(knownString, resultString)
def testKnownValue(self): """buildConnectionString returns known result with known input""" params = { "server": "mpilgrim", "database": "master", "uid": "sa", "pwd": "secret" } knownItems = params.items() knownItems.sort() knownString = repr(knownItems) result = odbchelper.buildConnectionString(params) resultItems = [tuple(e.split("=")) for e in result.split(";")] resultItems.sort() resultString = repr(resultItems) self.assertEqual(knownString, resultString)
def testBlank(self): """buildConnectionString handles empty dictionary""" self.assertEqual("", odbchelper.buildConnectionString({}))
import odbchelper params = { "server": "mpilgrim", "database": "master", "uid": "sa", "pwd": "secret" } print odbchelper.buildConnectionString(params) print odbchelper.buildConnectionString.__doc__ # Traceback (most recent call last): # File "ex2.py", line 1, in <module> # import odbchelper # ImportError: No module named odbchelper
def main(): params={"server":"mpilgrim", "database":"master", "uid":"sa", "pwd":"secret"} print odbchelper.buildConnectionString(params) print odbchelper.buildConnectionString.__doc__
def call_buildConnectionString(): params = {"server":"mpilgrim", "database":"master", "uid":"sa", "pwd":"secret"} return odbchelper.buildConnectionString(params)
import odbchelper if __name__ == "__main__": params = {"server":"mpilgrim", "database":"master", "uid":"sa", "pwd":"secret"} print odbchelper.buildConnectionString(params) print odbchelper.buildConnectionString.__doc__