Back to index

python3.2  3.2.2
Public Member Functions
test.test_set.TestVariousIteratorArgs Class Reference

List of all members.

Public Member Functions

def test_constructor
def test_inline_methods
def test_inplace_methods

Detailed Description

Definition at line 1622 of file test_set.py.


Member Function Documentation

Definition at line 1624 of file test_set.py.

01624 
01625     def test_constructor(self):
01626         for cons in (set, frozenset):
01627             for s in ("123", "", range(1000), ('do', 1.2), range(2000,2200,5)):
01628                 for g in (G, I, Ig, S, L, R):
01629                     self.assertEqual(sorted(cons(g(s)), key=repr), sorted(g(s), key=repr))
01630                 self.assertRaises(TypeError, cons , X(s))
01631                 self.assertRaises(TypeError, cons , N(s))
01632                 self.assertRaises(ZeroDivisionError, cons , E(s))

Here is the call graph for this function:

Definition at line 1633 of file test_set.py.

01633 
01634     def test_inline_methods(self):
01635         s = set('november')
01636         for data in ("123", "", range(1000), ('do', 1.2), range(2000,2200,5), 'december'):
01637             for meth in (s.union, s.intersection, s.difference, s.symmetric_difference, s.isdisjoint):
01638                 for g in (G, I, Ig, L, R):
01639                     expected = meth(data)
01640                     actual = meth(G(data))
01641                     if isinstance(expected, bool):
01642                         self.assertEqual(actual, expected)
01643                     else:
01644                         self.assertEqual(sorted(actual, key=repr), sorted(expected, key=repr))
01645                 self.assertRaises(TypeError, meth, X(s))
01646                 self.assertRaises(TypeError, meth, N(s))
01647                 self.assertRaises(ZeroDivisionError, meth, E(s))

Here is the call graph for this function:

Definition at line 1648 of file test_set.py.

01648 
01649     def test_inplace_methods(self):
01650         for data in ("123", "", range(1000), ('do', 1.2), range(2000,2200,5), 'december'):
01651             for methname in ('update', 'intersection_update',
01652                              'difference_update', 'symmetric_difference_update'):
01653                 for g in (G, I, Ig, S, L, R):
01654                     s = set('january')
01655                     t = s.copy()
01656                     getattr(s, methname)(list(g(data)))
01657                     getattr(t, methname)(g(data))
01658                     self.assertEqual(sorted(s, key=repr), sorted(t, key=repr))
01659 
01660                 self.assertRaises(TypeError, getattr(set('january'), methname), X(data))
01661                 self.assertRaises(TypeError, getattr(set('january'), methname), N(data))
01662                 self.assertRaises(ZeroDivisionError, getattr(set('january'), methname), E(data))

Here is the call graph for this function:


The documentation for this class was generated from the following file: