(self)
| 241 | self.assertEqual(f.read(), '2.0\n2\n') |
| 242 | |
| 243 | def testBreak(self): |
| 244 | splootFile = splootFromPython(''' |
| 245 | x = 10 |
| 246 | while x > 0: |
| 247 | x = x - 1 |
| 248 | if x == 8: |
| 249 | print('continuing') |
| 250 | continue |
| 251 | print(x) |
| 252 | if x == 5: |
| 253 | print('breaking') |
| 254 | break |
| 255 | print('hi') |
| 256 | ''') |
| 257 | |
| 258 | f = io.StringIO() |
| 259 | f.write = wrapStdout(f.write) |
| 260 | with contextlib.redirect_stdout(f): |
| 261 | executePythonFile(splootFile) |
| 262 | |
| 263 | f.seek(0) |
| 264 | self.assertEqual(f.read(), '''9 |
| 265 | continuing |
| 266 | 7 |
| 267 | 6 |
| 268 | 5 |
| 269 | breaking |
| 270 | hi |
| 271 | ''') |
| 272 | |
| 273 | def testDict(self): |
| 274 | splootFile = splootFromPython('''d = {"hello": "hallo"} |
nothing calls this directly
no test coverage detected