call site 0 for path.local.open
apigen/source/testing/test_browser.py - line 10
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
   def test_browser():
       tmp = py.test.ensuretemp("sourcebrowser")
->     tmp.ensure("a.py").write(py.code.Source("""
       def f():
           pass
       
       def g():
           pass
           
       class X:
           pass
           
       class Z(object):
           x = 1
           def zzz(self):
               1
               2
               3
               4
       """))
       mod = parse_path(tmp.join("a.py"))
       assert isinstance(mod.g, Function)
       assert isinstance(mod.Z, Class)
       py.test.raises(AttributeError, "mod.zzz")
       assert mod.g.firstlineno == 5
       assert mod.g.name == "g"
       assert mod.g.endlineno == 6
       assert mod.X.firstlineno == 8
       assert mod.X.endlineno == 9
       assert mod.Z.bases == ["object"]
       assert isinstance(mod.Z.zzz, Method)
       assert mod.Z.zzz.firstlineno == 13
       assert mod.Z.zzz.endlineno == 17
path/local/local.py - line 309
298
299
300
301
302
303
304
305
306
307
308
309
310
   def ensure(self, *args, **kwargs):
       """ ensure that an args-joined path exists (by default as
               a file). if you specify a keyword argument 'dir=True'
               then the path is forced to be a directory path.
           """
       p = self.join(*args)
       if kwargs.get('dir', 0):
           return p._ensuredirs()
       else:
           p.dirpath()._ensuredirs()
           if not p.check(file=1):
->             p.write("")
           return p
path/local/local.py - line 276
273
274
275
276
277
278
279
280
   def write(self, content, mode='wb'):
       """ write string content into path. """
       s = str(content)
->     f = self.open(mode)
       try:
           f.write(s)
       finally:
           f.close()