コード例 #1
0
	def testPrivateDataMembers(self):
		try:
			data = 92
			u = language.DataMembers(data)
			k = u.hidden
			self.failUnless(0, "AttributeError not thrown")
		except AttributeError:
			pass # OK!
コード例 #2
0
	def testPublicDataMembers1(self):
		data = 92
		u = language.DataMembers(data)
		self.assertEquals(u.square, data * data);
		self.assertEquals(type(u.e), language.El);
		self.assertEquals(u.m, language.EM);

		self.assertEquals(u.zero, 0)
コード例 #3
0
	def testEnums(self):
		self.failUnless(type(language.EM) is language.Em);
		self.assertEquals(type(language.EM), language.Em);
		d = language.DataMembers(1)
		d.setEm(language.EM)
		self.assertEquals(d.m, language.EM)
		d.setEm(language.Em(1))
		self.assertEquals(d.m, language.Em(1))
コード例 #4
0
	def testSaver(self):
		import language
		import with_xparam
		import xparam
		import StringIO

		arg = 71
		dm = language.DataMembers(arg)
		out = StringIO.StringIO()
		xparam.Saver(out).save(dm)
		self.assertEquals(out.getvalue().strip(),
						  "DataMembers(%i)" % (arg * arg))
コード例 #5
0
	def testPublicDataMembers2(self):
		data = 26
		u = language.DataMembers(data)
		u.v.v = data
		self.assertEquals(u.v.v, data)