Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moving files #305

Merged
merged 5 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from numpy.random import Generator, PCG64
import pandas as pd
import numpy as np
import synthetic_data.dataset_generators.datetime_generator as dtg
import synthetic_data.distinct_generators.datetime_generator as date_generator


class TestDatetimeFunctions(unittest.TestCase):
Expand All @@ -14,13 +14,13 @@ def setUp(self):
self.date_format_list = ["%Y-%m-%d", "%d-%m-%Y"]

def test_generate_datetime_return_type(self):
date_str = dtg.generate_datetime(
date_str = date_generator.generate_datetime(
self.rng, self.date_format_list[0], self.start_date, self.end_date
)
self.assertIsInstance(date_str, str)

def test_generate_datetime_format(self):
date_str = dtg.generate_datetime(
date_str = date_generator.generate_datetime(
self.rng, self.date_format_list[0], self.start_date, self.end_date
)
try:
Expand All @@ -29,22 +29,22 @@ def test_generate_datetime_format(self):
self.fail("pd.to_datetime() raised ValueError unexpectedly")

def test_generate_datetime_range(self):
date_str = dtg.generate_datetime(
date_str = date_generator.generate_datetime(
self.rng, self.date_format_list[0], self.start_date, self.end_date
)
date_obj = pd.to_datetime(date_str, format=self.date_format_list[0])
self.assertTrue(self.start_date <= date_obj)
self.assertTrue(date_obj <= self.end_date)

def test_random_datetimes_return_type_and_size(self):
result = dtg.random_datetimes(
result = date_generator.random_datetimes(
self.rng, self.date_format_list, self.start_date, self.end_date, 5
)
self.assertIsInstance(result, np.ndarray)
self.assertEqual(result.shape[0], 5)

def test_random_datetimes_default_format_usage(self):
result = dtg.random_datetimes(
result = date_generator.random_datetimes(
self.rng, None, self.start_date, self.end_date, 10
)
for date_str in result:
Expand All @@ -54,7 +54,7 @@ def test_random_datetimes_default_format_usage(self):
self.fail("pd.to_datetime() raised ValueError unexpectedly")

def test_random_datetimes_format_usage(self):
result = dtg.random_datetimes(
result = date_generator.random_datetimes(
self.rng, self.date_format_list, self.start_date, self.end_date, 10
)
format_success = [False] * len(self.date_format_list)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
import numpy as np
from numpy.random import Generator, PCG64
from synthetic_data.dataset_generators.float_generator import random_floats
from synthetic_data.distinct_generators.float_generator import random_floats
lizlouise1335 marked this conversation as resolved.
Show resolved Hide resolved


class TestRandomFloats(unittest.TestCase):
Expand Down