Skip to content

Commit

Permalink
Fix pylint errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
nusbaume committed Aug 26, 2021
1 parent 1e56860 commit 0f9daf1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
5 changes: 2 additions & 3 deletions cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def nml_attr_set(config):
set namelist defaults.
"""

#Create new namelist attribute dictionary:
cam_nml_attr_dict = dict()
#Create new (empty) namelist attribute dictionary:
cam_nml_attr_dict = {}

if config:
#Loop over all CAM configuration settings in config dictionary:
Expand Down Expand Up @@ -98,7 +98,6 @@ def buildnml(case, caseroot, compname):
# End if
srcroot = case.get_value("SRCROOT")
rundir = case.get_value("RUNDIR")
din_loc_root = case.get_value("DIN_LOC_ROOT")
atm_ncpl = case.get_value("ATM_NCPL")
cam_namelist_opts = case.get_value("CAM_NAMELIST_OPTS")
cam_nml_use_case = case.get_value("CAM_NML_USE_CASE")
Expand Down
18 changes: 9 additions & 9 deletions test/unit/cam_config_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,11 @@ def test_config_ccpp_phys_set_check_single_suite(self):
#Set "new" physics_suites value with one physics suite:
self.test_config_cam.set_value("physics_suites", "kessler")

#Create namelist attribute dictionary:
cam_nml_attr_dict = dict()
#Create (empty) namelist attribute dictionary:
cam_nml_attr_dict = {}

#Create namelist file:
with open("test.txt", "w") as test_fil:
with open("test.txt", "w", encoding='UTF-8') as test_fil:
test_fil.write('!Namelist test file\n')
test_fil.write('physics_suite = "adiabatic"\n')

Expand Down Expand Up @@ -343,7 +343,7 @@ def test_config_ccpp_phys_set_check_multi_suite(self):
cam_nml_attr_dict = dict()

#Create namelist file:
with open("test.txt", "w") as test_fil:
with open("test.txt", "w", encoding='UTF-8') as test_fil:
test_fil.write('!Namelist test file\n')
test_fil.write('physics_suite = "adiabatic"\n')

Expand Down Expand Up @@ -377,7 +377,7 @@ def test_config_ccpp_phys_set_missing_phys(self):
ermsg += "in CAM_CONFIG_OPTS."

#Create namelist file:
with open("test.txt", "w") as test_fil:
with open("test.txt", "w", encoding='UTF-8') as test_fil:
test_fil.write('!Namelist test file\n')

#Expect "CamConfigValError":
Expand Down Expand Up @@ -412,7 +412,7 @@ def test_config_ccpp_phys_set_two_phys(self):
ermsg += "Only one 'physics_suite' line is allowed."

#Create namelist file:
with open("test.txt", "w") as test_fil:
with open("test.txt", "w", encoding='UTF-8') as test_fil:
test_fil.write('!Namelist test file\n')
test_fil.write('physics_suite = "adiabatic"\n')
test_fil.write('physics_suite = "kessler"\n')
Expand Down Expand Up @@ -449,7 +449,7 @@ def test_config_ccpp_phys_set_missing_equals(self):


#Create namelist file:
with open("test.txt", "w") as test_fil:
with open("test.txt", "w", encoding='UTF-8') as test_fil:
test_fil.write('!Namelist test file\n')
test_fil.write('physics_suite "adiabatic"\n')

Expand Down Expand Up @@ -484,7 +484,7 @@ def test_config_ccpp_phys_set_two_equals(self):
ermsg = "There must only be one equals (=) sign in the 'physics_suite' namelist line."

#Create namelist file:
with open("test.txt", "w") as test_fil:
with open("test.txt", "w", encoding='UTF-8') as test_fil:
test_fil.write('!Namelist test file\n')
test_fil.write('physics_suite == "adiabatic"\n')

Expand Down Expand Up @@ -522,7 +522,7 @@ def test_config_ccpp_phys_set_no_physics_suite_match(self):
ermsg += "listed in CAM_CONFIG_OPTS"

#Create namelist file:
with open("test.txt", "w") as test_fil:
with open("test.txt", "w", encoding='UTF-8') as test_fil:
test_fil.write('!Namelist test file\n')
test_fil.write('physics_suite = "cam6"\n')

Expand Down

0 comments on commit 0f9daf1

Please sign in to comment.