| 247 | pydevd_reload.notify_error = old |
| 248 | |
| 249 | def test_create_class(self): |
| 250 | SAMPLE_CODE1 = """ |
| 251 | class C: |
| 252 | def foo(self): |
| 253 | return 0 |
| 254 | """ |
| 255 | # Creating a new class and using it from old class |
| 256 | SAMPLE_CODE2 = """ |
| 257 | class B: |
| 258 | pass |
| 259 | |
| 260 | class C: |
| 261 | def foo(self): |
| 262 | return B |
| 263 | """ |
| 264 | |
| 265 | self.make_mod(sample=SAMPLE_CODE1) |
| 266 | import x # @UnresolvedImport |
| 267 | |
| 268 | foo = x.C().foo |
| 269 | self.assertEqual(foo(), 0) |
| 270 | self.make_mod(sample=SAMPLE_CODE2) |
| 271 | pydevd_reload.xreload(x) |
| 272 | self.assertEqual(foo().__name__, "B") |
| 273 | |
| 274 | def test_create_class2(self): |
| 275 | SAMPLE_CODE1 = """ |