Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
  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)
Ejemplo n.º 3
0
  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)