# Path: metrology/instruments/gauge.py
# class Gauge(object):
#     """
#     A gauge is an instantaneous measurement of a value ::
# 
#       class JobGauge(metrology.instruments.Gauge):
#           @property
#           def value(self):
#               return len(queue)
# 
#       gauge = Metrology.gauge('pending-jobs', JobGauge())
# 
#     """
#     @property
#     def value(self):
#         """"""
#         raise NotImplementedError
# 
# class RatioGauge(Gauge):
#     """
#     A ratio gauge is a simple way to create a gauge which is
#     the ratio between two numbers.
#     """
#     def numerator(self):
#         raise NotImplementedError
# 
#     def denominator(self):
#         raise NotImplementedError
# 
#     @property
#     def value(self):
#         d = self.denominator()
#         if math.isnan(d) or math.isinf(d) or d == 0.0 or d == 0:
#             return float('nan')
#         return self.numerator() / d
# 
# class PercentGauge(RatioGauge):
#     """
#     A percent gauge is a ratio gauge where the result is normalized
#     to a value between 0 and 100.
#     """
#     @property
#     def value(self):
#         value = super(PercentGauge, self).value
#         return value * 100
# 
# class ToggleGauge(Gauge):
#     _value = AtomicLong(1)
# 
#     @property
#     def value(self):
#         try:
#             return self._value.value
#         finally:
#             self._value.value = 0


import math
from unittest import TestCase
from metrology.instruments.gauge import Gauge, RatioGauge, PercentGauge, \
    ToggleGauge
    @property
    def value(self):
        return "wow"


class DummyRatioGauge(RatioGauge):
    def __init__(self, numerator, denominator):
        self.num = numerator
        self.den = denominator

    def numerator(self):
        return self.num

    def denominator(self):
        return self.den


class DummyPercentGauge(DummyRatioGauge, PercentGauge):
    pass


class GaugeTest(TestCase):
    def setUp(self):
        self.gauge = DummyGauge()

    def test_return_value(self):
        self.assertEqual(self.gauge.value, "wow")


class RatioGaugeTest(TestCase):

# Path: metrology/instruments/gauge.py
# class Gauge(object):
#     """
#     A gauge is an instantaneous measurement of a value ::
# 
#       class JobGauge(metrology.instruments.Gauge):
#           @property
#           def value(self):
#               return len(queue)
# 
#       gauge = Metrology.gauge('pending-jobs', JobGauge())
# 
#     """
#     @property
#     def value(self):
#         """"""
#         raise NotImplementedError
# 
# class RatioGauge(Gauge):
#     """
#     A ratio gauge is a simple way to create a gauge which is
#     the ratio between two numbers.
#     """
#     def numerator(self):
#         raise NotImplementedError
# 
#     def denominator(self):
#         raise NotImplementedError
# 
#     @property
#     def value(self):
#         d = self.denominator()
#         if math.isnan(d) or math.isinf(d) or d == 0.0 or d == 0:
#             return float('nan')
#         return self.numerator() / d
# 
# class PercentGauge(RatioGauge):
#     """
#     A percent gauge is a ratio gauge where the result is normalized
#     to a value between 0 and 100.
#     """
#     @property
#     def value(self):
#         value = super(PercentGauge, self).value
#         return value * 100
# 
# class ToggleGauge(Gauge):
#     _value = AtomicLong(1)
# 
#     @property
#     def value(self):
#         try:
#             return self._value.value
#         finally:
#             self._value.value = 0


# Path: tests/instruments/test_gauge.py
import math
from unittest import TestCase
from metrology.instruments.gauge import Gauge, RatioGauge, PercentGauge, \
    ToggleGauge

    @property
    def value(self):
        return "wow"


class DummyRatioGauge(RatioGauge):
    def __init__(self, numerator, denominator):
        self.num = numerator
        self.den = denominator

    def numerator(self):
        return self.num

    def denominator(self):
        return self.den


class DummyPercentGauge(DummyRatioGauge, PercentGauge):
    pass


class GaugeTest(TestCase):
    def setUp(self):
        self.gauge = DummyGauge()

    def test_return_value(self):
        self.assertEqual(self.gauge.value, "wow")


class RatioGaugeTest(TestCase):

    def test_ratio(self):