[Zope-CVS] CVS: PythonNet/src/testing - PyObjectTests.cs:1.1 ArrayTest.cs:1.3

Brian Lloyd brian at zope.com
Mon Oct 20 23:05:46 EDT 2003


Update of /cvs-repository/PythonNet/src/testing
In directory cvs.zope.org:/tmp/cvs-serv26410/src/testing

Modified Files:
	ArrayTest.cs 
Added Files:
	PyObjectTests.cs 
Log Message:
Check in the Great Type Refactoring before I go and break it again. All of 
the tests pass again (well, except for two that were failing before the 
refactoring).

The end result is a nice net reduction of C# code, letting the Python 
runtime handle much more of the work of creating types. 

The refactored version also plays nicely with the Python GC, so the 
Python GC no longer needs to be disabled to run things under Python 
for .NET. :) Also added some very preliminary leak and stress testing 
scripts.



=== Added File PythonNet/src/testing/PyObjectTests.cs ===
// Copyright (c) 2001, 2002 Zope Corporation and Contributors.
//
// All Rights Reserved.
//
// This software is subject to the provisions of the Zope Public License,
// Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
// WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
// FOR A PARTICULAR PURPOSE.

using NUnit.Framework;
using Python.Runtime;
using System;

namespace Python.Runtime.UnitTests {

    /// <summary>
    /// Test fixture for the PyObject class. The PyObject class is 
    /// generally equivalent to the Python "abstract object API". See  
    /// http://www.python.org/doc/current/api/object.html for details.
    /// </summary>

    [ TestFixture ]
    public class PyObjectTests {

    [Test]
    public void TestPyObjectProperties() {
	PyObject obj = PythonEngine.ImportModule("sys");

	Assertion.Assert(obj.Handle != IntPtr.Zero);

    }


    }


}


=== PythonNet/src/testing/ArrayTest.cs 1.2 => 1.3 ===
--- PythonNet/src/testing/ArrayTest.cs:1.2	Tue Sep 30 19:54:12 2003
+++ PythonNet/src/testing/ArrayTest.cs	Mon Oct 20 23:05:15 2003
@@ -309,6 +309,25 @@
 
     }
 
-    // add multi-rank, etc.
+
+    public class ArrayConversionTest {
+
+	public static Spam[] EchoRange(Spam[] items) {
+	    return items;
+	}
+
+	public static Spam[,] EchoRangeMD(Spam[,] items) {
+	    return items;
+	}
+
+	public static Spam[][] EchoRangeAA(Spam[][] items) {
+	    return items;
+	}
+
+    }
+
+
+
 
 }
+




More information about the Zope-CVS mailing list