Example #1
0
class TestIPABase(unittest.TestCase):
	def setUp(self):
		self.compiler  = CompilerContext(None)
		self.extractor = MockExtractor()
		self.compiler.extractor = self.extractor
		self.canonical = CanonicalObjects()
		existingPolicy = None
		externalPolicy = None

		self.analysis = IPAnalysis(self.compiler, self.canonical, existingPolicy, externalPolicy)

	def local(self, context, name, *values):
		lcl = context.local(name)
		if values: lcl.updateValues(frozenset(values))
		return lcl

	def assertIsInstance(self, obj, cls):
		self.assert_(isinstance(obj, cls), "expected %r, got %r" % (cls, type(obj)))

	def const(self, pyobj, qualifier=qualifiers.HZ):
		obj = self.extractor.getObject(pyobj)
		xtype = self.canonical.existingType(obj)
		return self.analysis.objectName(xtype, qualifier)

	def makeContext(self):
		return self.analysis.getContext(MockSignature())
Example #2
0
	def setUp(self):
		self.compiler  = CompilerContext(None)
		self.extractor = MockExtractor()
		self.compiler.extractor = self.extractor
		self.canonical = CanonicalObjects()
		existingPolicy = None
		externalPolicy = None

		self.analysis = IPAnalysis(self.compiler, self.canonical, existingPolicy, externalPolicy)