diff --git a/foamlib/_files/_files.py b/foamlib/_files/_files.py index 6bf5eae..5a963df 100644 --- a/foamlib/_files/_files.py +++ b/foamlib/_files/_files.py @@ -186,12 +186,10 @@ def __setitem__( try: write_header = ( - not self - and "FoamFile" not in self - and (not keywords or keywords[0] != "FoamFile") + not self and "FoamFile" not in self and keywords != ("FoamFile",) ) except FileNotFoundError: - write_header = not keywords or keywords[0] != "FoamFile" + write_header = keywords != ("FoamFile",) if write_header: self["FoamFile"] = {}