[Zope-CVS] CVS: PythonNet/tests/python - test_class.py:1.2
Brian Lloyd
brian@zope.com
Sat, 2 Aug 2003 17:55:39 -0400
Update of /cvs-repository/PythonNet/tests/python
In directory cvs.zope.org:/tmp/cvs-serv16324/tests/python
Modified Files:
test_class.py
Log Message:
various optimizations and cleanups
=== PythonNet/tests/python/test_class.py 1.1 => 1.2 ===
--- PythonNet/tests/python/test_class.py:1.1 Mon Feb 17 22:44:38 2003
+++ PythonNet/tests/python/test_class.py Sat Aug 2 17:55:34 2003
@@ -9,10 +9,21 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
+from CLR.System.Collections import Hashtable
from CLR.Python.Test import ClassTest
import sys, os, string, unittest, types
import CLR.System as System
+
+class ClassicClass:
+ def kind(self):
+ return 'classic'
+
+class NewStyleClass(object):
+ def kind(self):
+ return 'new-style'
+
+
class ClassTests(unittest.TestCase):
"""Test CLR class support."""
@@ -46,6 +57,26 @@
x = Test.InternalClass
self.failUnlessRaises(AttributeError, test)
+
+
+ def testBasicSubclass(self):
+ """Test basic subclass of a managed class."""
+
+ class MyTable(Hashtable):
+
+ def __getitem__(self, key):
+ value = Hashtable.__getitem__(self, key)
+ return 'my ' + str(value)
+
+ table = MyTable()
+ table['one'] = 'one'
+ table['two'] = 'two'
+ table['three'] = 'three'
+
+ self.failUnless(table['one'] == 'my one')
+ self.failUnless(table.Count == 3)
+
+
def test_suite():