Exemplo n.º 1
0
 def testFireTraceElementAsStringWithTarget(self):
     el = trace.FireTraceElement(
         component='Example',
         action='Created toy',
         target='Beaker',
     )
     self.assertEqual(str(el), 'Created toy "Beaker"')
Exemplo n.º 2
0
 def testFireTraceElementAsStringWithTargetAndLineNo(self):
     el = trace.FireTraceElement(
         component='Example',
         action='Created toy',
         target='Beaker',
         filename='beaker.py',
         lineno=10,
     )
     self.assertEqual(str(el), 'Created toy "Beaker" (beaker.py:10)')
Exemplo n.º 3
0
 def testFireTraceElementAsStringWithTargetAndLineNo(self):
     el = trace.FireTraceElement(
         component="Example",
         action="Created toy",
         target="Beaker",
         filename="beaker.py",
         lineno=10,
     )
     self.assertEqual(str(el), 'Created toy "Beaker" (beaker.py:10)')
Exemplo n.º 4
0
 def testFireTraceElementAsStringNoMetadata(self):
     el = trace.FireTraceElement(
         component='Example',
         action='Fake action',
     )
     self.assertEqual(str(el), 'Fake action')
Exemplo n.º 5
0
    def testFireTraceElementHasError(self):
        el = trace.FireTraceElement()
        self.assertFalse(el.HasError())

        el = trace.FireTraceElement(error=ValueError('example error'))
        self.assertTrue(el.HasError())
Exemplo n.º 6
0
 def testFireTraceElementAsStringNoMetadata(self):
     el = trace.FireTraceElement(
         component="Example",
         action="Fake action",
     )
     self.assertEqual(str(el), "Fake action")