Best Python code snippet using slash
traceback_proxy.py
Source:traceback_proxy.py
...99 self._obj.tb_frame = ctypes.pointer(frame)100 else:101 self._obj.tb_frame = ctypes.POINTER(TracebackProxy._Frame)()102 @property103 def tb_lasti(self):104 return self._tb.tb_lasti105 @tb_lasti.setter106 def tb_lasti(self, lasti):107 self._obj.tb_lasti = lasti108 @property109 def tb_lineno(self):110 return self._tb.tb_lineno111 @tb_lineno.setter112 def tb_lineno(self, lineno):113 self._obj.tb_lineno = lineno114 def __eq__(self, other):115 return self._tb == other._tb # pylint: disable=protected-access116 def __ne__(self, other):117 return self._tb != other._tb # pylint: disable=protected-access118 @staticmethod119 def create_traceback():120 try:...
exceptions.py
Source:exceptions.py
...15 tb = tb.tb_next16 yield tb17 def tb_frame(self):18 return self.__curframe.tb_frame19 def tb_lasti(self):20 return self.__curframe.tb_lasti21 def tb_lineno(self):22 return self.__curframe.tb_lineno23 def tb_next(self):24 six.next(self.__iterator)25 return self26@implements_to_string27class TransactionAborted(psycopg2.DatabaseError):28 def __init__(self, exc_info, cur_exc_info):29 self.exc_info = exc_info30 self.cur_exc_info = cur_exc_info31 def __repr__(self):32 return "\n".join(traceback.format_exception(self.__class__, self, self.get_traceback()))33 def __str__(self):...
apptest_traceback.py
Source:apptest_traceback.py
1import sys2from pytest import raises3from types import TracebackType4def ve():5 raise ValueError6def get_tb():7 try:8 ve()9 except ValueError as e:10 return e.__traceback__11def test_mutation():12 tb = get_tb()13 # allowed14 tb.tb_next = None15 assert tb.tb_next is None16 tb2 = get_tb()17 tb.tb_next = tb218 assert tb.tb_next is tb219 with raises(TypeError):20 tb.tb_next = "rabc"21 # loops are forbidden22 with raises(ValueError):23 tb2.tb_next = tb24 with raises(ValueError):25 tb.tb_next = tb26 tb.tb_lasti = 123327 assert tb.tb_lasti == 123328 with raises(TypeError):29 tb.tb_lasti = "abc"30 tb.tb_lineno = 123331 assert tb.tb_lineno == 123332 with raises(TypeError):33 tb.tb_lineno = "abc"34 35def test_construct():36 frame = sys._getframe()37 tb = get_tb()38 tb2 = TracebackType(tb, frame, 1, 2)39 assert tb2.tb_next is tb40 assert tb2.tb_frame is frame41 assert tb2.tb_lasti == 142 assert tb2.tb_lineno == 243 tb2 = TracebackType(tb, frame, 1, -1)44 assert tb2.tb_next is tb45 assert tb2.tb_frame is frame46 assert tb2.tb_lasti == 147 assert tb2.tb_lineno == -148def test_can_subclass():49 with raises(TypeError):50 class TB(TracebackType):...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!