[Pyobjc-dev] testing NSCell
Brought to you by:
ronaldoussoren
From: David E. <epp...@ic...> - 2003-02-04 19:17:01
|
Which if any of the following tests should fail? Currently, they all do. import unittest import objc from AppKit import NSCell class TestNSCell(unittest.TestCase): cell = NSCell.alloc().init() def testString(self): s = 'string' self.cell.setStringValue_(s) assert(self.cell.stringValue() == s) assert(str(self.cell) == s) def testUnicode(self): u = u'\xc3\xbc\xc3\xb1\xc3\xae\xc3\xa7\xc3\xb8d\xc3\xa8' self.cell.setStringValue_(u) assert(self.cell.stringValue() == u) assert(unicode(self.cell) == u) def testInt(self): i = 17 self.cell.setIntValue_(i) assert(self.cell.intValue() == i) assert(int(self.cell) == i) def testFloat(self): f = 3.14159 self.cell.setFloatValue_(f) assert(self.cell.floatValue() == f) assert(float(self.cell) == f) def suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestNSCell)) return suite if __name__ == '__main__': unittest.main( ) -- David Eppstein UC Irvine Dept. of Information & Computer Science epp...@ic... http://www.ics.uci.edu/~eppstein/ |