Code Duplication    Length = 18-18 lines in 2 locations

tests/test_Apex.py 2 locations

@@ 841-858 (lines=18) @@
838
        np.testing.assert_allclose(mapped, test_mapped, rtol=1e-5)
839
        return
840
841
    @pytest.mark.parametrize('ivec', range(0, 5))
842
    def test_map_V_to_height_array_location(self, ivec):
843
        """Test mapping of velocity to a specified height with array input."""
844
        # Set the base input and output values
845
        evel = np.array([[1, 2, 3]] * 2).transpose()
846
        in_args = [60, 15, 100, 500, evel]
847
        test_mapped = np.full(shape=(2, 3),
848
                              fill_value=[0.81971957, 2.84512495,
849
                                          0.69545001]).transpose()
850
851
        # Update inputs for one vectorized value if this is a location input
852
        if ivec < 4:
853
            in_args[ivec] = [in_args[ivec], in_args[ivec]]
854
855
        # Get the mapped output and test the results
856
        mapped = self.apex_out.map_V_to_height(*in_args)
857
        np.testing.assert_allclose(mapped, test_mapped, rtol=1e-5)
858
        return
859
860
861
class TestApexBasevectorMethods():
@@ 803-820 (lines=18) @@
800
        np.testing.assert_allclose(mapped, test_mapped, rtol=1e-5)
801
        return
802
803
    @pytest.mark.parametrize('ivec', range(0, 5))
804
    def test_map_E_to_height_array_location(self, ivec):
805
        """Test mapping of E-field to a specified height with array input."""
806
        # Set the base input and output values
807
        efield = np.array([[1, 2, 3]] * 2).transpose()
808
        in_args = [60, 15, 100, 500, efield]
809
        test_mapped = np.full(shape=(2, 3),
810
                              fill_value=[0.71152183, 2.35624876,
811
                                          0.57260784]).transpose()
812
813
        # Update inputs for one vectorized value if this is a location input
814
        if ivec < 4:
815
            in_args[ivec] = [in_args[ivec], in_args[ivec]]
816
817
        # Get the mapped output and test the results
818
        mapped = self.apex_out.map_E_to_height(*in_args)
819
        np.testing.assert_allclose(mapped, test_mapped, rtol=1e-5)
820
        return
821
822
    @pytest.mark.parametrize("in_args,test_mapped",
823
                             [([60, 15, 100, 500, [1, 2, 3]],