class TestParameter(TestCase):

    def setUp(self):
        TestCase.setUp(self)

        getter = lambda geometry: geometry.inclusion_diameter_m
        setter = lambda geometry, val: setattr(geometry, 'inclusion_diameter_m', val)
        self.param = Parameter(getter, setter, 200e-9, 150e-9, 300e-9)

    def tearDown(self):
        TestCase.tearDown(self)

    def testgetter(self):
        geometry = Inclusion(pure(29), pure(30), 250e-9)
        self.assertAlmostEqual(250e-9, self.param.getter(geometry), 13)

    def testsetter(self):
        geometry = Inclusion(pure(29), pure(30), 250e-9)
        self.param.setter(geometry, 160e-9)
        self.assertAlmostEqual(160e-9, geometry.inclusion_diameter_m, 13)

    def testinitial_value(self):
        self.assertAlmostEqual(200e-9, self.param.initial_value, 13)

    def testconstraints(self):
        constraints = self.param.constraints
        self.assertAlmostEqual(150e-9, constraints[0], 13)
        self.assertAlmostEqual(300e-9, constraints[1], 13)
    def setUp(self):
        TestCase.setUp(self)

        getter = lambda geometry: geometry.inclusion_diameter_m
        setter = lambda geometry, val: setattr(geometry, 'inclusion_diameter_m', val)
        self.param = Parameter(getter, setter, 200e-9, 150e-9, 300e-9)