コード例 #1
0
 def test_num_cases(self):
     uni = Uniform(10)
     uni.num_parameters = 3
     cases = [case for case in uni]
     expected = 10*[[1.0,1.0,1.0]]
     self.assertEqual(len(expected),len(cases))
     self.assertEqual(len(expected[0]),len(cases[0]))    
コード例 #2
0
    def test_nested_loop(self):
        # test to make sure the generator can handle nested loops
        uni = Uniform(5)
        uni.num_parameters = 2

        inner_count = 0
        outer_count = 0
        for case_outer in uni:
            outer_count += 1
            for case_inner in uni:
                inner_count += 1

        self.assertEqual(5,outer_count)
        self.assertEqual(25,inner_count)
コード例 #3
0
    def test_nested_loop(self):
        # test to make sure the generator can handle nested loops
        uni = Uniform(5)
        uni.num_parameters = 2

        inner_count = 0
        outer_count = 0
        for case_outer in uni:
            outer_count += 1
            for case_inner in uni:
                inner_count += 1

        self.assertEqual(5, outer_count)
        self.assertEqual(25, inner_count)
コード例 #4
0
 def test_num_cases(self):
     uni = Uniform(10)
     uni.num_parameters = 3
     cases = [case for case in uni]