コード例 #1
0
    def testparametrized_mutable_sequence(self):
        s = ParameterizedMutableSequence()
        s.append((4.0, 5.0))
        self.obj.param1 = s

        self.assertEqual(len(self.obj.__parameters__),
                         len(list(iter_parameters(self.obj))))
        self.assertEqual(2, len(list(iter_values(self.obj))))
コード例 #2
0
    def testparametrized_mutable_set(self):
        s = ParameterizedMutableSet()
        s.add(4.0)
        self.obj.param1 = s

        self.assertEqual(len(self.obj.__parameters__) + 1,
                         len(list(iter_parameters(self.obj))))
        self.assertEqual(1, len(list(iter_values(self.obj))))
コード例 #3
0
    def testiter_values2(self):
        subobj1 = MockParameterization('subobj1')
        subobj1.param1 = [88, 108]
        self.obj.param1 = subobj1
        self.obj.param3 = [98, 99]

        items = list(iter_values(self.obj))
        self.assertEqual(4, len(items))
コード例 #4
0
    def testparametrized_mutable_mapping(self):
        d = ParameterizedMutableMapping()
        d['a'] = [1.0, 4.0, 9.0]
        d['b'] = 6.0
        self.obj.param1 = d

        self.assertEqual(len(self.obj.__parameters__) + 2,
                         len(list(iter_parameters(self.obj))))
        self.assertEqual(4, len(list(iter_values(self.obj))))
        self.assertEqual(3, len(expand(self.obj)))
コード例 #5
0
    def testiter_values(self):
        subobj1 = MockParameterization('subobj1')
        subobj1.param1 = [88, 108]
        self.obj.param1 = subobj1

        items = list(iter_values(self.obj))

        self.assertEqual(2, len(items))
        for i in range(2):
            self.assertEqual('param1', items[i][1])