def testGenSimple(self): """Type checking of typed generator.""" self.assertEquals([1, 2], generics.ConvertGenToList(e for e in [1, 2])) gen = generics._BadGen() with self.assertRaises(checker.CheckTypeAnnotationError) as context: generics.ConvertGenToList(gen)
def testGenSimple(self): """Type checking of typed generator.""" self.assertEquals([1, 2], generics.ConvertGenToList( e for e in [1, 2])) gen = generics._BadGen() with self.assertRaises(checker.CheckTypeAnnotationError) as context: generics.ConvertGenToList(gen)
def testGenSimple(self): """Type checking of typed generator.""" self.assertEquals([1, 2], generics.ConvertGenToList( e for e in [1, 2])) gen = generics._BadGen() with self.assertRaises(checker.CheckTypeAnnotationError) as context: generics.ConvertGenToList(gen) expected = checker.GeneratorGenericTypeErrorMsg("ConvertGenToList", gen, 3, float, int) [gen_error] = context.exception.args[0] self.assertEquals(expected, gen_error)