Back to index

python3.2  3.2.2
Classes | Functions | Variables
test.test_set Namespace Reference

Classes

class  PassThru
class  BadCmp
class  ReprWrapper
class  HashCountingInt
class  TestJointOps
class  TestSet
class  SetSubclass
class  TestSetSubclass
class  SetSubclassWithKeywordArgs
class  TestSetSubclassWithKeywordArgs
class  TestFrozenSet
class  FrozenSetSubclass
class  TestFrozenSetSubclass
class  TestBasicOps
class  TestBasicOpsEmpty
class  TestBasicOpsSingleton
class  TestBasicOpsTuple
class  TestBasicOpsTriple
class  TestBasicOpsString
class  TestBasicOpsBytes
class  TestBasicOpsMixedStringBytes
class  TestExceptionPropagation
class  TestSetOfSets
class  TestBinaryOps
class  TestUpdateOps
class  TestMutate
class  TestSubsets
class  TestSubsetEqualEmpty
class  TestSubsetEqualNonEmpty
class  TestSubsetEmptyNonEmpty
class  TestSubsetPartial
class  TestSubsetNonOverlap
class  TestOnlySetsInBinaryOps
class  TestOnlySetsNumeric
class  TestOnlySetsDict
class  TestOnlySetsOperator
class  TestOnlySetsTuple
class  TestOnlySetsString
class  TestOnlySetsGenerator
class  TestCopying
class  TestCopyingEmpty
class  TestCopyingSingleton
class  TestCopyingTriple
class  TestCopyingTuple
class  TestCopyingNested
class  TestIdentities
class  G
class  I
class  Ig
class  X
class  N
class  E
class  S
class  TestVariousIteratorArgs
class  bad_eq
class  bad_dict_clear
class  TestWeirdBugs
class  TestGraphs

Functions

def check_pass_thru
def baditer
def gooditer
def R
def L
def powerset
def cube
def linegraph
def faces
def test_main

Variables

tuple empty_set = set()

Class Documentation

class test::test_set::SetSubclass

Definition at line 612 of file test_set.py.

class test::test_set::FrozenSetSubclass

Definition at line 692 of file test_set.py.


Function Documentation

Definition at line 926 of file test_set.py.

00926 
00927 def baditer():
00928     raise TypeError
00929     yield True

Here is the caller graph for this function:

Definition at line 16 of file test_set.py.

00016 
00017 def check_pass_thru():
00018     raise PassThru
00019     yield 1

Here is the caller graph for this function:

def test.test_set.cube (   n)
Graph of n-dimensional hypercube.

Definition at line 1709 of file test_set.py.

01709 
01710 def cube(n):
01711     """Graph of n-dimensional hypercube."""
01712     singletons = [frozenset([x]) for x in range(n)]
01713     return dict([(x, frozenset([x^s for s in singletons]))
01714                  for x in powerset(range(n))])

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_set.faces (   G)

Definition at line 1727 of file test_set.py.

01727 
01728 def faces(G):
01729     'Return a set of faces in G.  Where a face is a set of vertices on that face'
01730     # currently limited to triangles,squares, and pentagons
01731     f = set()
01732     for v1, edges in G.items():
01733         for v2 in edges:
01734             for v3 in G[v2]:
01735                 if v1 == v3:
01736                     continue
01737                 if v1 in G[v3]:
01738                     f.add(frozenset([v1, v2, v3]))
01739                 else:
01740                     for v4 in G[v3]:
01741                         if v4 == v2:
01742                             continue
01743                         if v1 in G[v4]:
01744                             f.add(frozenset([v1, v2, v3, v4]))
01745                         else:
01746                             for v5 in G[v4]:
01747                                 if v5 == v3 or v5 == v2:
01748                                     continue
01749                                 if v1 in G[v5]:
01750                                     f.add(frozenset([v1, v2, v3, v4, v5]))
01751     return f
01752 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 930 of file test_set.py.

00930 
00931 def gooditer():
00932     yield True

Here is the caller graph for this function:

def test.test_set.L (   seqn)

Definition at line 1618 of file test_set.py.

01618 
01619 def L(seqn):
01620     'Test multiple tiers of iterators'
01621     return chain(map(lambda x:x, R(Ig(G(seqn)))))

Here is the call graph for this function:

Graph, the vertices of which are edges of G,
with two vertices being adjacent iff the corresponding
edges share a vertex.

Definition at line 1715 of file test_set.py.

01715 
01716 def linegraph(G):
01717     """Graph, the vertices of which are edges of G,
01718     with two vertices being adjacent iff the corresponding
01719     edges share a vertex."""
01720     L = {}
01721     for x in G:
01722         for y in G[x]:
01723             nx = [frozenset([x,z]) for z in G[x] if z != y]
01724             ny = [frozenset([y,z]) for z in G[y] if z != x]
01725             L[frozenset([x,y])] = frozenset(nx+ny)
01726     return L

Here is the caller graph for this function:

Generates all subsets of a set or sequence U.

Definition at line 1698 of file test_set.py.

01698 
01699 def powerset(U):
01700     """Generates all subsets of a set or sequence U."""
01701     U = iter(U)
01702     try:
01703         x = frozenset([next(U)])
01704         for S in powerset(U):
01705             yield S
01706             yield S | x
01707     except StopIteration:
01708         yield frozenset()

Here is the caller graph for this function:

def test.test_set.R (   seqn)

Definition at line 1545 of file test_set.py.

01545 
01546 def R(seqn):
01547     'Regular generator'
01548     for i in seqn:
01549         yield i

Here is the caller graph for this function:

def test.test_set.test_main (   verbose = None)

Definition at line 1802 of file test_set.py.

01802 
01803 def test_main(verbose=None):
01804     test_classes = (
01805         TestSet,
01806         TestSetSubclass,
01807         TestSetSubclassWithKeywordArgs,
01808         TestFrozenSet,
01809         TestFrozenSetSubclass,
01810         TestSetOfSets,
01811         TestExceptionPropagation,
01812         TestBasicOpsEmpty,
01813         TestBasicOpsSingleton,
01814         TestBasicOpsTuple,
01815         TestBasicOpsTriple,
01816         TestBasicOpsString,
01817         TestBasicOpsBytes,
01818         TestBasicOpsMixedStringBytes,
01819         TestBinaryOps,
01820         TestUpdateOps,
01821         TestMutate,
01822         TestSubsetEqualEmpty,
01823         TestSubsetEqualNonEmpty,
01824         TestSubsetEmptyNonEmpty,
01825         TestSubsetPartial,
01826         TestSubsetNonOverlap,
01827         TestOnlySetsNumeric,
01828         TestOnlySetsDict,
01829         TestOnlySetsOperator,
01830         TestOnlySetsTuple,
01831         TestOnlySetsString,
01832         TestOnlySetsGenerator,
01833         TestCopyingEmpty,
01834         TestCopyingSingleton,
01835         TestCopyingTriple,
01836         TestCopyingTuple,
01837         TestCopyingNested,
01838         TestIdentities,
01839         TestVariousIteratorArgs,
01840         TestGraphs,
01841         TestWeirdBugs,
01842         )
01843 
01844     support.run_unittest(*test_classes)
01845 
01846     # verify reference counting
01847     if verbose and hasattr(sys, "gettotalrefcount"):
01848         import gc
01849         counts = [None] * 5
01850         for i in range(len(counts)):
01851             support.run_unittest(*test_classes)
01852             gc.collect()
01853             counts[i] = sys.gettotalrefcount()
01854         print(counts)


Variable Documentation

tuple test.test_set.empty_set = set()

Definition at line 726 of file test_set.py.