diff --git a/fprettify/__init__.py b/fprettify/__init__.py index 5e1544b..abeb488 100644 --- a/fprettify/__init__.py +++ b/fprettify/__init__.py @@ -2234,18 +2234,19 @@ def reformat_ffile_combined( lines, is_special, orig_filename, stream.line_nr ) - linebreak_pos = get_linebreak_pos( - lines, not indent_fypp, orig_filename, stream.line_nr - ) - f_line = f_line.strip(" ") if impose_replacements: f_line = replace_relational_single_fline(f_line, cstyle) + lines = [replace_relational_single_fline(l, cstyle) for l in lines] if impose_case: f_line = replace_keywords_single_fline(f_line, case_dict) + linebreak_pos = get_linebreak_pos( + lines, not indent_fypp, orig_filename, stream.line_nr + ) + if impose_whitespace: lines = format_single_fline( f_line, diff --git a/fprettify/tests/unittests.py b/fprettify/tests/unittests.py index eca05b4..421c3ca 100644 --- a/fprettify/tests/unittests.py +++ b/fprettify/tests/unittests.py @@ -384,7 +384,7 @@ def test_relation_replacement(self): "'==== heading", "if (vtk%my_rank .eq. 0) write (vtk%filehandle_par, '(\"",', - "if (abc(1) .lt. -bca .or. &\n qwe .gt. ewq) then", + "if (abc(1)<=-bca .or. &\n qwe .gt. ewq) then", ] f_outstring = [ "if (min .lt. max .and. min .lt. thres)", @@ -396,7 +396,7 @@ def test_relation_replacement(self): "'==== heading", "if (vtk%my_rank .eq. 0) write (vtk%filehandle_par, '(\"",', - "if (abc(1) .lt. -bca .or. &\n qwe .gt. ewq) then", + "if (abc(1) .le. -bca .or. &\n qwe .gt. ewq) then", ] c_outstring = [ "if (min < max .and. min < thres)", @@ -408,7 +408,7 @@ def test_relation_replacement(self): "'==== heading", "if (vtk%my_rank == 0) write (vtk%filehandle_par, '(\"",', - "if (abc(1) < -bca .or. &\n qwe > ewq) then", + "if (abc(1) <= -bca .or. &\n qwe > ewq) then", ] for i in range(0, len(instring)): self.assert_fprettify_result(