From 2ac63f04712bb0a31a8d0e86f2ec0a27948ade90 Mon Sep 17 00:00:00 2001 From: Jakub Both Date: Wed, 21 Aug 2024 22:01:44 +0200 Subject: [PATCH] TST: Integrate enumerations in tests. --- tests/unit/test_variational_wasserstein_distance.py | 8 ++++---- tests/unit/test_wasserstein.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/unit/test_variational_wasserstein_distance.py b/tests/unit/test_variational_wasserstein_distance.py index 9d2ddbc6..4704be68 100644 --- a/tests/unit/test_variational_wasserstein_distance.py +++ b/tests/unit/test_variational_wasserstein_distance.py @@ -27,7 +27,7 @@ options = { # Method definition - "l1_mode": "raviart_thomas", + "l1_mode": darsia.L1Mode.RAVIART_THOMAS, } grid = darsia.generate_grid(dst_image_2d) @@ -40,7 +40,7 @@ def test_vector_face_flux_norm_cell_based(): """Compare with the manually determined exact cell based face mobility.""" # NOTE the coarse tolerance due to such large quadrature error - options.update({"mobility_mode": "cell_based"}) + options.update({"mobility_mode": darsia.MobilityMode.CELL_BASED}) w1 = darsia.VariationalWassersteinDistance(grid, options=options) _, face_weight_inv = w1._compute_face_weight(flat_flux) # Identify flux norm as face weight inv @@ -49,7 +49,7 @@ def test_vector_face_flux_norm_cell_based(): def test_vector_face_flux_norm_subcell_based(): """Compare with the manually determined exact subcell based face mobility.""" - options.update({"mobility_mode": "subcell_based"}) + options.update({"mobility_mode": darsia.MobilityMode.SUBCELL_BASED}) w1 = darsia.VariationalWassersteinDistance(grid, options=options) _, face_weight_inv = w1._compute_face_weight(flat_flux) # Identify flux norm as face weight inv @@ -61,7 +61,7 @@ def test_vector_face_flux_norm_subcell_based(): def test_vector_face_flux_norm_face_based(): """Compare with the manually determined exact face based face mobility.""" - options.update({"mobility_mode": "face_based"}) + options.update({"mobility_mode": darsia.MobilityMode.FACE_BASED}) w1 = darsia.VariationalWassersteinDistance(grid, options=options) _, face_weight_inv = w1._compute_face_weight(flat_flux) # Identify flux norm as face weight inv diff --git a/tests/unit/test_wasserstein.py b/tests/unit/test_wasserstein.py index 23476b71..ae38473e 100644 --- a/tests/unit/test_wasserstein.py +++ b/tests/unit/test_wasserstein.py @@ -123,8 +123,8 @@ # General options options = { # Method definition - "l1_mode": "constant_cell_projection", - "mobility_mode": "face_based", + "l1_mode": darsia.L1Mode.CONSTANT_CELL_PROJECTION, + "mobility_mode": darsia.MobilityMode.FACE_BASED, # Performance control "num_iter": 400, "tol_residual": 1e-10,