def setUp(self) -> None: """setUp method which creates a dummy data :obj:`dict` which is used within the tests. Additionally it instantiates the :class:`~.ConfigFileWriter` class.""" this_dir = os.path.dirname(os.path.abspath(__file__)) self.out_dir = os.path.join(this_dir, "test_resources/datastorewriter") self.point_name = "point" self.line_name = "line" self.plane_name = "plane" with open(os.path.join(this_dir, "../../default/config.json")) as f: loaded_json = json.load(f) self.config = RIDTConfig(loaded_json) self.ds = DataStore() self.space = np.linspace(0, 10, 10) self.point_data = np.array(self.space) self.line_data = np.array( [self.space, self.space]) self.plane_data = np.array( [[self.space, self.space], [self.space, self.space]]) self.domain_data = np.array( [[[self.space, self.space], [self.space, self.space]], [[self.space, self.space], [self.space, self.space]]] )
def setUp(self) -> None: this_dir = os.path.dirname(os.path.abspath(__file__)) path = os.path.join(this_dir, "../../default/config.json") with open(path) as f: loaded_json = json.load(f) self.config = RIDTConfig(loaded_json) self.domain = Domain(self.config)
def setUp(self) -> None: """setUp method which instantiates the :class:`~.RIDTConfig` class.""" this_dir = os.path.dirname(os.path.abspath(__file__)) path = os.path.join(this_dir, "../../default/config.json") with open(path) as f: loaded_json = json.load(f) self.config = RIDTConfig(loaded_json)
def setUp(self) -> None: this_dir = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(this_dir, "test_resources/test_config.json")) as f: loaded_json = json.load(f) self.config = RIDTConfig(loaded_json) self.wm = WellMixed(self.config)
def setUp(self) -> None: """setUp method which instantiates the :class:`~.RIDTConfig` class, the :class:`~.PointPlot` class, and creates some initial variables.""" self.this_dir = os.path.dirname(os.path.abspath(__file__)) with open( os.path.join(self.this_dir, "test_resources/test_config.json")) as f: loaded_json = json.load(f) self.config = RIDTConfig(loaded_json) self.config.consistency_check() self.pp = PointPlot( self.config, os.path.join(self.this_dir, "test_resources", "concentration")) self.time_array = np.linspace(0, 10, 10) self.conc = np.linspace(0, 10, 10) self.points = self.config.models.eddy_diffusion.monitor_locations.points
class TestPointPlot(unittest.TestCase): "Unit tests for the :class:`~.PointPlot` class." "" def setUp(self) -> None: """setUp method which instantiates the :class:`~.RIDTConfig` class, the :class:`~.PointPlot` class, and creates some initial variables.""" self.this_dir = os.path.dirname(os.path.abspath(__file__)) with open( os.path.join(self.this_dir, "test_resources/test_config.json")) as f: loaded_json = json.load(f) self.config = RIDTConfig(loaded_json) self.config.consistency_check() self.pp = PointPlot( self.config, os.path.join(self.this_dir, "test_resources", "concentration")) self.time_array = np.linspace(0, 10, 10) self.conc = np.linspace(0, 10, 10) self.points = self.config.models.eddy_diffusion.monitor_locations.points def tearDown(self) -> None: """tearDown method which removes and changes made in the tests.""" resource_list = os.listdir( os.path.join(self.this_dir, "test_resources")) for file in resource_list: if file.endswith(".pdf"): os.remove(os.path.join(self.this_dir, f"test_resources/{file}"))
def setUp(self) -> None: this_dir = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(this_dir, "test_resources/test_config.json")) as f: loaded_json = json.load(f) self.config = RIDTConfig(loaded_json) self.ed = EddyDiffusion(self.config) self.time_array = np.linspace(0, 10, 10) self.x_space = np.linspace(0, 10, 10) self.y_space = np.linspace(0, 10, 10) self.z_space = np.linspace(0, 10, 10)
def __instantiate_settings(self): """The method which instantiates the :class:`~.RIDTConfig` instances using the parsed data. Returns ------- :class:`~.RIDTConfig` The :class:`~.RIDTConfig` instance created using the parsed data. Raises ------ :class:`~.ConfigFileParserValidationError` If any :class:`~.SettingErrorMessage` errors are raised when instantiating the :class:`~.RIDTConfig` class. """ try: return RIDTConfig(self.data) except SettingErrorMessage as e: raise ConfigFileParserValidationError(self.path, e)