Esempio n. 1
0
    def test_unable_error(self):
        ''' 
        1. [1,2,3,5]

        To fail, an exception must occur within the ignore.get_frame method.
        Could not find a way to cause an exeption there.
        '''

        with pytest.raises(VarnameRetrievingError, match="Unable to"):
            varname(frame=2)
Esempio n. 2
0
 def test_parent_failed_error(self):
     '''
     3. [1,2,4,7,8,10]
     '''
     # Its suposed to be used within another function (or use frame = 0 karg)
     with pytest.raises(VarnameRetrievingError, match="Failed to"):
         name = varname(frame=3)
Esempio n. 3
0
    def test_unable_error_no_raise(self):
        ''' 
        2. [1,2,3,6]

        To fail, an exception must occur within the ignore.get_frame method.
        This is effectivelly the same test as above, but instead of raising an exception the 
        function returns None
        Could not find a way to cause an exeption there.
        '''
        assert varname(frame=2, raise_exc=False) is None
Esempio n. 4
0
 def foo():
     return varname()
Esempio n. 5
0
 def foo():
     return varname(multi_vars=True)
Esempio n. 6
0
 def test_parent_failed_error_no_raise(self):
     '''
     4. [1,2,4,7,8,11]
     '''
     # Its suposed to be used within another function (or use frame = 0 karg)
     assert varname(frame=3, raise_exc=False) is None