Exemple #1
0
 def testFireTraceElementAsStringWithTarget(self):
     el = trace.FireTraceElement(
         component='Example',
         action='Created toy',
         target='Beaker',
     )
     self.assertEqual(str(el), 'Created toy "Beaker"')
Exemple #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)')
Exemple #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)')
Exemple #4
0
 def testFireTraceElementAsStringNoMetadata(self):
     el = trace.FireTraceElement(
         component='Example',
         action='Fake action',
     )
     self.assertEqual(str(el), 'Fake action')
Exemple #5
0
    def testFireTraceElementHasError(self):
        el = trace.FireTraceElement()
        self.assertFalse(el.HasError())

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