Skip to content

Commit

Permalink
fix dependency issue
Browse files Browse the repository at this point in the history
  • Loading branch information
aidangannon committed Feb 27, 2024
1 parent 9f38e15 commit 0d28799
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions autofixture/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import datetime
import random
import typing
import uuid
from enum import Enum
from random import random
import random as rand

from autofixture.exceptions import AutoFixtureException

Expand Down Expand Up @@ -135,7 +134,7 @@ def __generate_class_list(self, _type, is_predictable_data, key, nest, new_value
nest=nest + 1))
else:
value_for_given_member = []
for i in range(0, random.randint(0, list_limit)):
for i in range(0, rand.randint(0, list_limit)):
value_for_given_member.append(self.create(dto=_type,
seed=seed,
num=num,
Expand All @@ -152,8 +151,8 @@ def __generate_list_of_enums_field(self, _type, is_predictable_data, key, new_va
value_for_given_member.append(enum_iterable[index])
else:
value_for_given_member = []
for i in range(0, random.randint(0, list_limit)):
value_for_given_member.append(random.choice(list(_type)))
for i in range(0, rand.randint(0, list_limit)):
value_for_given_member.append(rand.choice(list(_type)))
setattr(new_value, key, value_for_given_member)

def __generate_random_enum_field(self, _type, is_predictable_data, key, new_value, num):
Expand All @@ -163,7 +162,7 @@ def __generate_random_enum_field(self, _type, is_predictable_data, key, new_valu
index = num % length
value_for_given_member = enum_iterable[index]
else:
value_for_given_member = random.choice(list(_type))
value_for_given_member = rand.choice(list(_type))
setattr(new_value, key, value_for_given_member)

def __generate_datetime_list_field(self, is_predictable_data, key, new_value, num, list_limit):
Expand All @@ -173,7 +172,7 @@ def __generate_datetime_list_field(self, is_predictable_data, key, new_value, nu
value_for_given_member.append(datetime.datetime(2, 2, 2, 2, 2, 2))
else:
value_for_given_member = []
for i in range(0, random.randint(0, list_limit)):
for i in range(0, rand.randint(0, list_limit)):
value_for_given_member.append(datetime.datetime.utcnow())
setattr(new_value, key, value_for_given_member)

Expand All @@ -184,8 +183,8 @@ def __generate_bool_list_field(self, is_predictable_data, key, new_value, num, l
value_for_given_member.append(bool(num))
else:
value_for_given_member = []
for i in range(0, random.randint(0, list_limit)):
value_for_given_member.append(random.choice([True, False]))
for i in range(0, rand.randint(0, list_limit)):
value_for_given_member.append(rand.choice([True, False]))
setattr(new_value, key, value_for_given_member)

def __generate_datetime_field(self, is_predictable_data, key, new_value, num):
Expand All @@ -199,7 +198,7 @@ def __generate_bool_field(self, is_predictable_data, key, new_value, num):
if is_predictable_data:
value_for_given_member = bool(num)
else:
value_for_given_member = random.choice([True, False])
value_for_given_member = rand.choice([True, False])
setattr(new_value, key, value_for_given_member)

@staticmethod
Expand All @@ -214,8 +213,8 @@ def __generate_float_list_field(is_predictable_data, key, new_value, num, list_l
value_for_given_member.append(value_for_given_member_item)
else:
value_for_given_member = []
for i in range(0, random.randint(0, list_limit)):
value_for_given_member.append(random.uniform(0, 100))
for i in range(0, rand.randint(0, list_limit)):
value_for_given_member.append(rand.uniform(0, 100))
setattr(new_value, key, value_for_given_member)

@staticmethod
Expand All @@ -226,8 +225,8 @@ def __generate_int_list_field(is_predictable_data, key, new_value, num, list_lim
value_for_given_member.append(num + i)
else:
value_for_given_member = []
for i in range(0, random.randint(0, list_limit)):
value_for_given_member.append(random.randint(0, 100))
for i in range(0, rand.randint(0, list_limit)):
value_for_given_member.append(rand.randint(0, 100))
setattr(new_value, key, value_for_given_member)

def __generate_str_list_field(self, is_predictable_data, key, new_value, num, seed, list_limit):
Expand All @@ -239,7 +238,7 @@ def __generate_str_list_field(self, is_predictable_data, key, new_value, num, se
value_for_given_member.append(value_for_given_member_item)
else:
value_for_given_member = []
for i in range(0, random.randint(0, list_limit)):
for i in range(0, rand.randint(0, list_limit)):
value_for_given_member_item = key
value_for_given_member_item = f"{value_for_given_member_item}{self.__generate_random_seed()}"
value_for_given_member.append(value_for_given_member_item)
Expand All @@ -264,15 +263,15 @@ def __generate_float_field(is_predictable_data, key, new_value, num):
trailing_decimals = f"{trailing_decimals}{num}"
value_for_given_member = float(f"{num}.{trailing_decimals}")
else:
value_for_given_member = random.uniform(0, 100)
value_for_given_member = rand.uniform(0, 100)
setattr(new_value, key, value_for_given_member)

@staticmethod
def __generate_int_field(is_predictable_data, key, new_value, num):
if is_predictable_data:
value_for_given_member = num
else:
value_for_given_member = random.randint(0, 100)
value_for_given_member = rand.randint(0, 100)
setattr(new_value, key, value_for_given_member)

def __generate_string_field(self, is_predictable_data, key, new_value, seed):
Expand Down

0 comments on commit 0d28799

Please sign in to comment.