You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rd...@apache.org on 2010/02/14 18:40:10 UTC

svn commit: r910052 - /subversion/trunk/subversion/bindings/swig/python/tests/pool.py

Author: rdonch
Date: Sun Feb 14 17:40:09 2010
New Revision: 910052

URL: http://svn.apache.org/viewvc?rev=910052&view=rev
Log:
Add a test to the Python bindings' testsuite which tests functionality
implemented in r907788 (and r909644, indirectly).

* subversion/bindings/swig/python/tests/pool.py:
  (PoolTestCase.test_object_hash_struct_members): New function.


Modified:
    subversion/trunk/subversion/bindings/swig/python/tests/pool.py

Modified: subversion/trunk/subversion/bindings/swig/python/tests/pool.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/python/tests/pool.py?rev=910052&r1=910051&r2=910052&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/python/tests/pool.py (original)
+++ subversion/trunk/subversion/bindings/swig/python/tests/pool.py Sun Feb 14 17:40:09 2010
@@ -19,6 +19,7 @@
 #
 #
 import unittest, weakref, setup_path
+import os, tempfile
 import svn.core, svn.client, libsvn.core
 from svn.core import *
 from libsvn.core import application_pool, GenericSWIGWrapper
@@ -52,6 +53,33 @@
       head_revision.kind = auth
     self.assertRaises(TypeError, test_bad_assignment)
 
+  def test_object_hash_struct_members(self):
+    """Check that struct members which are hashes of objects work correctly"""
+
+    # Get an empty config
+    (cfg_fd, cfg_name) = tempfile.mkstemp(prefix="conf-")
+    os.close(cfg_fd)
+
+    try:
+      cfg = svn.core.svn_config_read(
+        svn.core.svn_dirent_internal_style(cfg_name),
+        False)
+    finally:
+      os.remove(cfg_name)
+
+    client_ctx = svn.client.svn_client_create_context()
+    category = svn.core.SVN_CONFIG_CATEGORY_SERVERS
+    client_ctx.config = { category: cfg }
+
+    # Check that parent pools are set correctly
+    self.assertEqual(client_ctx.config[category]._parent_pool,
+      cfg._parent_pool)
+
+    # Test invalid assignment
+    def test_bad_assignment(self):
+      client_ctx.config = 42
+    self.assertRaises(TypeError, test_bad_assignment)
+
   def test_assert_valid(self):
     """Test assert_valid method on proxy objects"""