Skip to content
Snippets Groups Projects
Commit 64d8c7c3 authored by dh00601's avatar dh00601
Browse files

fixing tests and imports

parent cef89a4f
No related branches found
No related tags found
No related merge requests found
...@@ -13,16 +13,22 @@ import numpy as np ...@@ -13,16 +13,22 @@ import numpy as np
from binarycpython import _binary_c_bindings from binarycpython import _binary_c_bindings
from binarycpython.utils.functions import ( from binarycpython.utils.functions import (
binarycDecoder,
temp_dir, temp_dir,
inspect_dict,
merge_dicts,
handle_ensemble_string_to_json,
verbose_print, verbose_print,
extract_ensemble_json_from_string,
is_capsule, is_capsule,
Capturing, Capturing,
) )
from binarycpython.utils.ensemble import (
binarycDecoder,
handle_ensemble_string_to_json,
extract_ensemble_json_from_string,
)
from binarycpython.utils.dicts import (
inspect_dict,
merge_dicts,
)
TMP_DIR = temp_dir("tests", "test_c_bindings") TMP_DIR = temp_dir("tests", "test_c_bindings")
......
...@@ -6,10 +6,46 @@ import os ...@@ -6,10 +6,46 @@ import os
import unittest import unittest
import tempfile import tempfile
from binarycpython.utils.custom_logging_functions import binary_c_log_code import json
from binarycpython.utils.run_system_wrapper import run_system import h5py
from binarycpython.utils.functions import * from binarycpython.utils.custom_logging_functions import (
binary_c_log_code
)
from binarycpython.utils.run_system_wrapper import (
run_system
)
from binarycython.utils.functions import (
temp_dir,
Capturing,
verbose_print,
remove_file,
get_username,
bin_data,
create_hdf5,
return_binary_c_version_info,
parse_binary_c_version_info,
output_lines,
get_defaults,
example_parse_output,
create_arg_string,
get_arg_keys,
get_help,
get_help_all,
get_help_super,
write_binary_c_parameter_descriptions_to_rst_file,
make_build_text
)
from binarycpython.utils.dicts import (
AutoVivificationDict,
inspect_dict,
merge_dicts
)
from binarcpython.utils.ensemble import (
binaryc_json_serializer,
handle_ensemble_string_to_json
)
TMP_DIR = temp_dir("tests", "test_functions") TMP_DIR = temp_dir("tests", "test_functions")
...@@ -723,7 +759,7 @@ class test_merge_dicts(unittest.TestCase): ...@@ -723,7 +759,7 @@ class test_merge_dicts(unittest.TestCase):
self.assertTrue(output_dict["bool"]) self.assertTrue(output_dict["bool"])
def test_ints(self): def test_ints(self):
with Capturing() as output: with Capturing() as _:
self._test_ints() self._test_ints()
def _test_ints(self): def _test_ints(self):
...@@ -758,7 +794,7 @@ class test_merge_dicts(unittest.TestCase): ...@@ -758,7 +794,7 @@ class test_merge_dicts(unittest.TestCase):
with Capturing() as output: with Capturing() as output:
self._test_lists() self._test_lists()
def test_lists(self): def _test_lists(self):
""" """
Test merging dict with lists Test merging dict with lists
""" """
...@@ -771,7 +807,7 @@ class test_merge_dicts(unittest.TestCase): ...@@ -771,7 +807,7 @@ class test_merge_dicts(unittest.TestCase):
self.assertEqual(output_dict["list"], [1, 2, 3, 4]) self.assertEqual(output_dict["list"], [1, 2, 3, 4])
def test_dicts(self): def test_dicts(self):
with Capturing() as output: with Capturing() as _:
self._test_dicts() self._test_dicts()
def _test_dicts(self): def _test_dicts(self):
...@@ -842,7 +878,7 @@ class test_handle_ensemble_string_to_json(unittest.TestCase): ...@@ -842,7 +878,7 @@ class test_handle_ensemble_string_to_json(unittest.TestCase):
""" """
def test_1(self): def test_1(self):
with Capturing() as output: with Capturing() as _:
self._test_1() self._test_1()
def _test_1(self): def _test_1(self):
...@@ -850,7 +886,7 @@ class test_handle_ensemble_string_to_json(unittest.TestCase): ...@@ -850,7 +886,7 @@ class test_handle_ensemble_string_to_json(unittest.TestCase):
Test passing string representation of a dictionary. Test passing string representation of a dictionary.
""" """
string_of_function = str(os.path.isfile) _ = str(os.path.isfile)
input_string = '{"ding": 10, "list_example": [1,2,3]}' input_string = '{"ding": 10, "list_example": [1,2,3]}'
output_dict = handle_ensemble_string_to_json(input_string) output_dict = handle_ensemble_string_to_json(input_string)
......
...@@ -12,14 +12,21 @@ import unittest ...@@ -12,14 +12,21 @@ import unittest
import numpy as np import numpy as np
from binarycpython.utils.grid import Population from binarycpython.utils.grid import Population
from binarycpython.utils.functions import ( from binarycpython.utils.functions import (
temp_dir, temp_dir,
extract_ensemble_json_from_string,
merge_dicts,
remove_file, remove_file,
Capturing, Capturing,
bin_data, bin_data,
) )
from binarycpython.utils.ensemble import (
extract_ensemble_json_from_string,
)
from binarycpython.utils.dicts import (
merge_dicts,
)
from binarycpython.utils.custom_logging_functions import binary_c_log_code from binarycpython.utils.custom_logging_functions import binary_c_log_code
TMP_DIR = temp_dir("tests", "test_grid") TMP_DIR = temp_dir("tests", "test_grid")
......
...@@ -4,46 +4,32 @@ population ensemble using the binarycpython package ...@@ -4,46 +4,32 @@ population ensemble using the binarycpython package
""" """
import astropy.units as u
import binarycpython.utils.moe_di_stefano_2017_data as moe_di_stefano_2017_data
from binarycpython import _binary_c_bindings
from binarycpython.utils.dicts import (
keys_to_floats,
recursive_change_key_to_float,
custom_sort_dict,
recursive_change_key_to_string,
)
import bz2 import bz2
import collections import time
from colorama import Fore, Back, Style
import copy from typing import Any
import datetime as dt
import gc import gc
import gzip import gzip
from halo import Halo
import h5py
import humanize
import inspect import inspect
from io import StringIO
import json
from halo import Halo
import msgpack import msgpack
import numpy as np
import os
import psutil
import py_rinterpolate import py_rinterpolate
import re
import resource
import sys
import subprocess
import tempfile
import time
import types
from typing import Union, Any
import simplejson import simplejson
# import orjson # import orjson
from colorama import Fore, Back, Style
from binarycpython.utils.dicts import (
keys_to_floats,
recursive_change_key_to_float,
custom_sort_dict,
recursive_change_key_to_string,
)
def ensemble_setting(ensemble, parameter_name): def ensemble_setting(ensemble, parameter_name):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment