import unittest

from stacklogger import srcfile

class TestUtils(unittest.TestCase):
    
    def test_srcfile(self):
        self.assertTrue(srcfile("foo.py").endswith("foo.py"))
        self.assertTrue(srcfile("foo.pyc").endswith("foo.py"))
        self.assertTrue(srcfile("foo.pyo").endswith("foo.py"))
        self.assertTrue(srcfile("foo").endswith("foo"))

import inspect
import unittest

from stacklogger import srcfile

currentframe = inspect.currentframe

class FakeFrames(object):
    
    def fake_method(self):
        return currentframe()
    
    @property
    def fake_property(self):
        return currentframe()

    @classmethod
    def fake_classmethod(cls):
        return currentframe()

    @staticmethod
    def fake_staticmethod():
        return currentframe()

def fake_function():
    return currentframe()

class TestUtils(unittest.TestCase):
    
    def test_srcfile(self):
        self.assertTrue(srcfile("foo.py").endswith("foo.py"))
        self.assertTrue(srcfile("foo.pyc").endswith("foo.py"))
        self.assertTrue(srcfile("foo.pyo").endswith("foo.py"))
        self.assertTrue(srcfile("foo").endswith("foo"))

Build fake frames for later testing.
Build fake frames for later testing.

+ import inspect
  import unittest
  
  from stacklogger import srcfile
+ 
+ currentframe = inspect.currentframe
+ 
+ class FakeFrames(object):
+     
+     def fake_method(self):
+         return currentframe()
+     
+     @property
+     def fake_property(self):
+         return currentframe()
+ 
+     @classmethod
+     def fake_classmethod(cls):
+         return currentframe()
+ 
+     @staticmethod
+     def fake_staticmethod():
+         return currentframe()
+ 
+ def fake_function():
+     return currentframe()
  
  class TestUtils(unittest.TestCase):
      
      def test_srcfile(self):
          self.assertTrue(srcfile("foo.py").endswith("foo.py"))
          self.assertTrue(srcfile("foo.pyc").endswith("foo.py"))
          self.assertTrue(srcfile("foo.pyo").endswith("foo.py"))
          self.assertTrue(srcfile("foo").endswith("foo"))
  
Build fake frames for later testing.
## Code Before:
import unittest

from stacklogger import srcfile

class TestUtils(unittest.TestCase):
    
    def test_srcfile(self):
        self.assertTrue(srcfile("foo.py").endswith("foo.py"))
        self.assertTrue(srcfile("foo.pyc").endswith("foo.py"))
        self.assertTrue(srcfile("foo.pyo").endswith("foo.py"))
        self.assertTrue(srcfile("foo").endswith("foo"))

## Instruction:
Build fake frames for later testing.
## Code After:
import inspect
import unittest

from stacklogger import srcfile

currentframe = inspect.currentframe

class FakeFrames(object):
    
    def fake_method(self):
        return currentframe()
    
    @property
    def fake_property(self):
        return currentframe()

    @classmethod
    def fake_classmethod(cls):
        return currentframe()

    @staticmethod
    def fake_staticmethod():
        return currentframe()

def fake_function():
    return currentframe()

class TestUtils(unittest.TestCase):
    
    def test_srcfile(self):
        self.assertTrue(srcfile("foo.py").endswith("foo.py"))
        self.assertTrue(srcfile("foo.pyc").endswith("foo.py"))
        self.assertTrue(srcfile("foo.pyo").endswith("foo.py"))
        self.assertTrue(srcfile("foo").endswith("foo"))
