diff options
author | Attila Oláh <attilaolah@gmail.com> | 2013-07-05 14:05:51 +0200 |
---|---|---|
committer | Attila Oláh <attilaolah@gmail.com> | 2013-07-05 14:05:51 +0200 |
commit | 7d8ea47bf423190a894257948bc7ffa01dc80dfc (patch) | |
tree | 582309e0faa3da44383da616d11d8ee706e661e6 | |
parent | b373a73a7fcf05c29255f60c58f0b84094f03c81 (diff) | |
download | pyflakes-7d8ea47bf423190a894257948bc7ffa01dc80dfc.tar.gz |
added test case
-rw-r--r-- | pyflakes/test/test_return_with_arguments_inside_generator.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/pyflakes/test/test_return_with_arguments_inside_generator.py b/pyflakes/test/test_return_with_arguments_inside_generator.py new file mode 100644 index 0000000..8ec8234 --- /dev/null +++ b/pyflakes/test/test_return_with_arguments_inside_generator.py @@ -0,0 +1,34 @@ + +from sys import version_info + +from pyflakes import messages as m +from pyflakes.test.harness import TestCase, skipIf + + +class Test(TestCase): + @skipIf(version_info >= (3,), 'new in Python 3') + def test_return(self): + self.flakes(''' + class a: + def b(): + for x in a.c: + if x: + yield x + return a + ''', m.ReturnWithArgsInsideGenerator) + + @skipIf(version_info >= (3,), 'new in Python 3') + def test_returnNone(self): + self.flakes(''' + def a(): + yield 12 + return None + ''', m.ReturnWithArgsInsideGenerator) + + @skipIf(version_info >= (3,), 'new in Python 3') + def test_returnYieldExpression(self): + self.flakes(''' + def a(): + b = yield a + return b + ''', m.ReturnWithArgsInsideGenerator) |