| 117 | |
| 118 | |
| 119 | class MyClass: |
| 120 | |
| 121 | def __init__(self): |
| 122 | print('inputs:') |
| 123 | self.sc_number = 3 |
| 124 | results = self.my_function() |
| 125 | print('results [mode=each]:') |
| 126 | print(results) |
| 127 | |
| 128 | @self_consistency(5, keys=['name', 'age', 'city'], mode='each') |
| 129 | def my_function(self): |
| 130 | name = ['Alice', 'Bob'] |
| 131 | age = [28, 39] |
| 132 | city = ['New York', 'San Francisco'] |
| 133 | skills = ['Python', 'JavaScript', 'Java'] |
| 134 | output = { |
| 135 | 'name': random.choice(name), |
| 136 | 'age': random.choice(age), |
| 137 | 'city': random.choice(city), |
| 138 | 'skill': random.choices(skills, k=2), |
| 139 | } |
| 140 | print(output) |
| 141 | return output |
| 142 | |
| 143 | |
| 144 | if __name__ == "__main__": |