Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(194484)

Side by Side Diff: Lib/test/test_pep380.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_pep3120.py ('k') | Lib/test/test_platform.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 2
3 """ 3 """
4 Test suite for PEP 380 implementation 4 Test suite for PEP 380 implementation
5 5
6 adapted from original tests written by Greg Ewing 6 adapted from original tests written by Greg Ewing
7 see <http://www.cosc.canterbury.ac.nz/greg.ewing/python/yield-from/YieldFrom-Pyt hon3.1.2-rev5.zip> 7 see <http://www.cosc.canterbury.ac.nz/greg.ewing/python/yield-from/YieldFrom-Pyt hon3.1.2-rev5.zip>
8 """ 8 """
9 9
10 import unittest 10 import unittest
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 yield call_stack() 928 yield call_stack()
929 yield call_stack() 929 yield call_stack()
930 930
931 def spam(g): 931 def spam(g):
932 yield from g 932 yield from g
933 933
934 def eggs(g): 934 def eggs(g):
935 yield from g 935 yield from g
936 936
937 for stack in spam(gen()): 937 for stack in spam(gen()):
938 self.assertTrue('spam' in stack) 938 self.assertIn('spam', stack)
939 939
940 for stack in spam(eggs(gen())): 940 for stack in spam(eggs(gen())):
941 self.assertTrue('spam' in stack and 'eggs' in stack) 941 self.assertIn('spam', stack)
942 self.assertIn('eggs', stack)
942 943
943 def test_custom_iterator_return(self): 944 def test_custom_iterator_return(self):
944 # See issue #15568 945 # See issue #15568
945 class MyIter: 946 class MyIter:
946 def __iter__(self): 947 def __iter__(self):
947 return self 948 return self
948 def __next__(self): 949 def __next__(self):
949 raise StopIteration(42) 950 raise StopIteration(42)
950 def gen(): 951 def gen():
951 nonlocal ret 952 nonlocal ret
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 996
996 997
997 def test_main(): 998 def test_main():
998 from test import support 999 from test import support
999 test_classes = [TestPEP380Operation] 1000 test_classes = [TestPEP380Operation]
1000 support.run_unittest(*test_classes) 1001 support.run_unittest(*test_classes)
1001 1002
1002 1003
1003 if __name__ == '__main__': 1004 if __name__ == '__main__':
1004 test_main() 1005 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_pep3120.py ('k') | Lib/test/test_platform.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+