# HG changeset patch
# User Simon King
# Date 1363818232 -3600
# Node ID 29efdbc99b1f098c8bdacd433f7730b3e7e2a09b
# Parent e134bc6c6c082ce2a49c649374ead4bf773ab26d
#14278: Add one test.
diff --git a/sage/structure/unique_representation.py b/sage/structure/unique_representation.py
--- a/sage/structure/unique_representation.py
+++ b/sage/structure/unique_representation.py
@@ -491,6 +491,42 @@
sage: c is C(3)
False
+ Here is a similar example, using a private classcall in the class
+ ``B``, which is not inherited by ``C``::
+
+ sage: class A(UniqueRepresentation):
+ ... def __init__(self, x):
+ ... pass
+ sage: class B(A):
+ ... @staticmethod
+ ... def __classcall_private__(cls, *args, **kwds):
+ ... print "Private B"
+ ... return super(B,cls).__classcall__(cls,*args,**kwds)
+ sage: class C(B): pass
+ sage: a = A(1)
+ sage: b = B(2)
+ Private B
+ sage: c = C(3)
+ sage: a is A(1)
+ True
+ sage: b is B(2)
+ Private B
+ True
+ sage: c is C(3)
+ True
+ sage: B._clear_cache_()
+
+ Again, all instances of (sub-classes of) ``B`` have disappeared
+ from the cache::
+
+ sage: a is A(1)
+ True
+ sage: b is B(2)
+ Private B
+ False
+ sage: c is C(3)
+ False
+
"""
del_list = []
cache = None