def testLengthMetricSFailedWithNoneIndex(self): self.assertRaises(LengthMetric()[None], InvalidArgumentException)
def testLengthMetricSFailedWithWrongIndex(self): self.assertRaises(LengthMetric()["Hello"], InvalidArgumentException)
def __set__(self, instance, value): instance.meter = value / LengthMetric()[LengthType.MILE]
def testLengthMetricSucces(self): f = LengthMetric()[LengthType.FOOT] self.assertEquals(3.28084, f)
def __get__(self, instance, owner): return instance.meter * LengthMetric()[LengthType.MILE]