~hardware-certification/zope3/certify-staging-2.5

« back to all changes in this revision

Viewing changes to src/zope/rdb/tests/.svn/text-base/stubs.py.svn-base

  • Committer: Marc Tardif
  • Date: 2008-04-26 19:03:34 UTC
  • Revision ID: cr3@lime-20080426190334-u16xo4llz56vliqf
Initial import.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
##############################################################################
 
2
#
 
3
# Copyright (c) 2002 Zope Corporation and Contributors.
 
4
# All Rights Reserved.
 
5
#
 
6
# This software is subject to the provisions of the Zope Public License,
 
7
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
 
8
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 
9
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 
10
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 
11
# FOR A PARTICULAR PURPOSE.
 
12
#
 
13
##############################################################################
 
14
"""Stubs for Zope RDB unit tests.
 
15
 
 
16
$Id$
 
17
"""
 
18
 
 
19
class ConnectionStub(object):
 
20
 
 
21
    def __init__(self):
 
22
        self._called={}
 
23
 
 
24
    def cursor(self):
 
25
        return CursorStub()
 
26
 
 
27
    def answer(self):
 
28
        return 42
 
29
 
 
30
    def commit(self, *ignored):
 
31
        v = self._called.setdefault('commit',0)
 
32
        v+=1
 
33
        self._called['commit']=v
 
34
 
 
35
    def rollback(self, *ignored):
 
36
        v = self._called.setdefault('rollback',0)
 
37
        v+=1
 
38
        self._called['rollback']=v
 
39
 
 
40
class CursorStub(object):
 
41
 
 
42
    def execute(*args, **kw):
 
43
        pass
 
44
 
 
45
class TypeInfoStub(object):
 
46
    paramstyle = 'pyformat'
 
47
    threadsafety = 0
 
48
    encoding = 'utf-8'
 
49
 
 
50
    def setEncoding(self, encoding):
 
51
        self.encoding = encoding
 
52
 
 
53
    def getEncoding(self):
 
54
        return self.encoding
 
55
 
 
56
    def getConverter(self, type):
 
57
        return lambda x: x