Ejemplo n.º 1
0
    def testGeneratorIsNotIterable(self):
        def Generator():
            yield 1
            yield 2
            yield 3

        with self.assertRaises(TypeError):
            utils.AssertIterableType(Generator(), int)
Ejemplo n.º 2
0
 def testIteratorIsNotIterable(self):
   with self.assertRaises(TypeError):
     utils.AssertIterableType(iter([u"foo", u"bar", u"baz"]), unicode)
Ejemplo n.º 3
0
 def testNonHomogeneousIntList(self):
   with self.assertRaises(TypeError):
     utils.AssertIterableType([4, 8, 15, 16.0, 23, 42], int)
Ejemplo n.º 4
0
 def testStringSetCorrect(self):
   del self  # Unused.
   utils.AssertIterableType({u"foo", u"bar", u"baz"}, unicode)
Ejemplo n.º 5
0
 def testAssertEmptyCorrect(self):
   del self  # Unused.
   utils.AssertIterableType([], int)
   utils.AssertIterableType({}, unicode)