def test_set_numpy_metric(self):
     try:
         import numpy as np
     except ImportError:
         raise SkipTest('numpy not installed')
     s = Span(tracer=None, name='test.span')
     s.set_metric('a', np.int64(1))
     assert s.get_metric('a') == 1
     assert type(s.get_metric('a')) == float
    def test_set_invalid_metric(self):
        s = Span(tracer=None, name='test.span')

        invalid_metrics = [
            None,
            {},
            [],
            s,
            'quarante-douze',
            float('nan'),
            float('inf'),
            1j
        ]

        for i, m in enumerate(invalid_metrics):
            k = str(i)
            s.set_metric(k, m)
            assert s.get_metric(k) is None