| 297 | self.assertEqual(foo().__name__, "B") |
| 298 | |
| 299 | def test_parent_function(self): |
| 300 | SAMPLE_CODE1 = """ |
| 301 | class B(object): |
| 302 | def foo(self): |
| 303 | return 0 |
| 304 | |
| 305 | class C(B): |
| 306 | def call(self): |
| 307 | return self.foo() |
| 308 | """ |
| 309 | # Creating a new class and using it from old class |
| 310 | SAMPLE_CODE2 = """ |
| 311 | class B(object): |
| 312 | def foo(self): |
| 313 | return 0 |
| 314 | def bar(self): |
| 315 | return 'bar' |
| 316 | |
| 317 | class C(B): |
| 318 | def call(self): |
| 319 | return self.bar() |
| 320 | """ |
| 321 | |
| 322 | self.make_mod(sample=SAMPLE_CODE1) |
| 323 | import x # @UnresolvedImport |
| 324 | |
| 325 | call = x.C().call |
| 326 | self.assertEqual(call(), 0) |
| 327 | self.make_mod(sample=SAMPLE_CODE2) |
| 328 | pydevd_reload.xreload(x) |
| 329 | self.assertEqual(call(), "bar") |
| 330 | |
| 331 | def test_update_constant(self): |
| 332 | SAMPLE_CODE1 = """ |