diff Lib/test/test_set.py @ 35348:2f1bf64b837e legacy-trunk

Numerous fix-ups to C API and docs. Added tests for C API.
author Raymond Hettinger <python@rcn.com>
date Tue, 16 Aug 2005 10:44:15 +0000
parents 725671db779a
children 37859c6ad5bb
line wrap: on
line diff
--- a/Lib/test/test_set.py	Tue Aug 16 03:54:11 2005 +0000
+++ b/Lib/test/test_set.py	Tue Aug 16 10:44:15 2005 +0000
@@ -6,6 +6,7 @@
 import pickle
 import os
 from random import randrange, shuffle
+import sys
 
 class PassThru(Exception):
     pass
@@ -402,6 +403,11 @@
         s = None
         self.assertRaises(ReferenceError, str, p)
 
+    # C API test only available in a debug build
+    if hasattr(sys, "gettotalrefcount"):
+        def test_c_api(self):
+            self.assertEqual(set('abc').test_c_api(), True)
+
 class SetSubclass(set):
     pass
 
@@ -1372,7 +1378,6 @@
 #==============================================================================
 
 def test_main(verbose=None):
-    import sys
     from test import test_sets
     test_classes = (
         TestSet,