Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jungtaekkim committed Nov 15, 2024
1 parent a7e2ded commit b7097a0
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 46 deletions.
4 changes: 2 additions & 2 deletions tests/common/test_import.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# author: Jungtaek Kim ([email protected])
# last updated: August 6, 2021
# author: Jungtaek Kim ([email protected])
# last updated: November 15, 2024
#
"""test_import"""

Expand Down
7 changes: 2 additions & 5 deletions tests/common/test_thompson_sampling.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# author: Jungtaek Kim ([email protected])
# last updated: December 19, 2021
# author: Jungtaek Kim ([email protected])
# last updated: November 15, 2024
#
"""test_thompson_sampling"""

Expand All @@ -11,9 +11,6 @@
from bayeso import constants


TEST_EPSILON = 1e-5


def test_thompson_sampling_gp_iteration_typing():
annos = package_target.thompson_sampling_gp_iteration.__annotations__

Expand Down
9 changes: 2 additions & 7 deletions tests/common/test_tp_kernel.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
#
# author: Jungtaek Kim ([email protected])
# last updated: March 22, 2021
# author: Jungtaek Kim ([email protected])
# last updated: November 15, 2024
#
"""test_tp_kernel"""

import typing
import pytest
import numpy as np

from bayeso import constants
from bayeso.tp import tp_kernel as package_target
from bayeso.utils import utils_covariance


TEST_EPSILON = 1e-7


def test_get_optimized_kernel_typing():
Expand Down
11 changes: 3 additions & 8 deletions tests/common/test_tp_tp.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
#
# author: Jungtaek Kim ([email protected])
# last updated: March 22, 2021
# author: Jungtaek Kim ([email protected])
# last updated: November 15, 2024
#
"""test_tp"""
"""test_tp_tp"""

import typing
import pytest
import numpy as np

from bayeso import constants
from bayeso.tp import tp as package_target
from bayeso.tp import tp_kernel
from bayeso.utils import utils_covariance


TEST_EPSILON = 1e-7


def test_sample_functions_typing():
Expand Down
7 changes: 2 additions & 5 deletions tests/common/test_trees_trees_random_forest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# author: Jungtaek Kim ([email protected])
# last updated: August 20, 2021
# author: Jungtaek Kim ([email protected])
# last updated: November 15, 2024
#
"""test_trees_trees_random_forest"""

Expand All @@ -12,9 +12,6 @@
from bayeso.trees import trees_random_forest as package_target


TEST_EPSILON = 1e-7


def test_get_random_forest_typing():
annos = package_target.get_random_forest.__annotations__

Expand Down
4 changes: 2 additions & 2 deletions tests/common/test_utils_bo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# author: Jungtaek Kim ([email protected])
# last updated: February 4, 2022
# author: Jungtaek Kim ([email protected])
# last updated: November 15, 2024
#
"""test_utils_bo"""

Expand Down
11 changes: 4 additions & 7 deletions tests/common/test_utils_common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# author: Jungtaek Kim ([email protected])
# last updated: December 15, 2022
# author: Jungtaek Kim ([email protected])
# last updated: November 15, 2024
#
"""test_utils_common"""

Expand All @@ -11,9 +11,6 @@
from bayeso.utils import utils_common as package_target


TEST_EPSILON = 1e-5


def test_validate_types_typing():
annos = package_target.validate_types.__annotations__

Expand Down Expand Up @@ -270,8 +267,8 @@ def test_get_time():

cur_time = package_target.get_time(arr_time, int_init, is_initial)
truth_cur_time = np.array([0.0, 0.8, 1.2, 2.6])
assert (np.abs(cur_time - truth_cur_time) < TEST_EPSILON).all()
np.testing.assert_allclose(cur_time, truth_cur_time)

cur_time = package_target.get_time(arr_time, int_init, False)
truth_cur_time = np.array([0.0, 1.06666667, 1.5, 2.3, 2.7, 4.1])
assert (np.abs(cur_time - truth_cur_time) < TEST_EPSILON).all()
np.testing.assert_allclose(cur_time, truth_cur_time)
4 changes: 2 additions & 2 deletions tests/common/test_utils_covariance.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# author: Jungtaek Kim ([email protected])
# last updated: December 29, 2020
# author: Jungtaek Kim ([email protected])
# last updated: November 15, 2024
#
"""test_utils_covariance"""

Expand Down
6 changes: 2 additions & 4 deletions tests/common/test_utils_gp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# author: Jungtaek Kim ([email protected])
# last updated: December 29, 2020
# author: Jungtaek Kim ([email protected])
# last updated: November 15, 2024
#
"""test_utils_gp"""

Expand All @@ -10,8 +10,6 @@

from bayeso.utils import utils_gp as package_target

TEST_EPSILON = 1e-7


def test_get_prior_mu_typing():
annos = package_target.get_prior_mu.__annotations__
Expand Down
4 changes: 2 additions & 2 deletions tests/common/test_utils_logger.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# author: Jungtaek Kim ([email protected])
# last updated: September 24, 2020
# author: Jungtaek Kim ([email protected])
# last updated: November 15, 2024
#
"""test_utils_logger"""

Expand Down
2 changes: 1 addition & 1 deletion tests/common/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# author: Jungtaek Kim ([email protected])
# last updated: April 30, 2024
#
"""test_import"""
"""test_version"""


STR_VERSION = "0.6.1"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# author: Jungtaek Kim ([email protected])
# author: Jungtaek Kim ([email protected])
# last updated: August 17, 2023
# Note that we referred to https://github.com/JaxGaussianProcesses/GPJax/blob/main/tests/integration_tests.py for implementing this test.
#
Expand Down

0 comments on commit b7097a0

Please sign in to comment.