예제 #1
0
    def test_bindRecursiveWithSkip(self):
        class BindMe(object):
            def a(self):
                pass

            def b(self):
                pass

            def c(self):
                pass

            def d(self):
                pass

        old_a = BindMe.a
        old_b = BindMe.b
        old_c = BindMe.c
        old_d = BindMe.d

        bindRecursive(BindMe, skip=['a', 'c'])

        self.assertEqual(BindMe.a, old_a)
        self.assertEqual(BindMe.c, old_c)
        self.assertNotEqual(BindMe.b, old_b)
        self.assertNotEqual(BindMe.d, old_d)
예제 #2
0
	def test_bindRecursiveWithSkip(self):
		class BindMe(object):
			def a(self): pass
			def b(self): pass
			def c(self): pass
			def d(self): pass

		old_a = BindMe.a
		old_b = BindMe.b
		old_c = BindMe.c
		old_d = BindMe.d

		bindRecursive(BindMe, skip=['a', 'c'])

		self.assertEqual(BindMe.a, old_a)
		self.assertEqual(BindMe.c, old_c)
		self.assertNotEqual(BindMe.b, old_b)
		self.assertNotEqual(BindMe.d, old_d)
예제 #3
0
    resumed = False
    stopped = False
    paused = False

    def __init__(self):
        self.log = ListLog()

    def getNew(self):
        return self.log.getNew()

    def resumeProducing(self):
        self.log.append(['resumeProducing'])
        self.resumed = True
        self.paused = False

    def pauseProducing(self):
        self.log.append(['pauseProducing'])
        self.paused = True

    def stopProducing(self):
        self.log.append(['stopProducing'])
        self.stopped = True


try:
    from refbinder.api import bindRecursive
except ImportError:
    pass
else:
    bindRecursive(sys.modules[__name__], _postImportVars)
예제 #4
0
				# Raise even if it was an optional field.
				raise PbDecodeError("For message %r expected index "
					"%r but it was missing." % (message, tag))
			self._deserializeMessageField(message, field, subdata)


	def deserialize(self, message, data):
		"""
		Puts values from C{data} into message C{message}.  The message
		is mutated, not returned.  Existing values are cleared.

		C{message} is a L{google.protobuf.message.Message}.
		C{data} is a L{list}.  Unneeded values are ignored (fillerValue
			is not used).

		If any part of C{data} is invalid, raises L{PbDecodeError}.

		Note that the deserializer is forgiving when it comes to bool fields -
		it will accept 1, 1.0, True, 0, 0.0, -0.0, and False.
		"""
		message.Clear()
		self._deserializeMessage(message, data)
		# We know it's initialized (has every field) because we iterated
		# over the fields, not the serialized data.



try: from refbinder.api import bindRecursive
except ImportError: pass
else: bindRecursive(sys.modules[__name__], _postImportVars)
예제 #5
0
	def test_bindRecursiveDummyNewStyle(self):
		bindRecursive(_DummyNewStyle)
예제 #6
0
 def test_bindRecursiveDummyNewStyle(self):
     bindRecursive(_DummyNewStyle)