Skip to content

Commit

Permalink
Bugfix in fline function.
Browse files Browse the repository at this point in the history
  • Loading branch information
rigoudyg committed Mar 8, 2024
1 parent 186981a commit b05ca4f
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
9 changes: 8 additions & 1 deletion climaf/chtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from __future__ import print_function, division, unicode_literals, absolute_import

import os
import pprint
import re
import pickle
import shutil
Expand Down Expand Up @@ -475,7 +476,13 @@ def foo(*args):
repr(sargs)))
return
else:
sargs = OrderedDict(list([(repr(sarg), sarg) for sarg in sargs]))
new_sargs = OrderedDict()
for sarg in sargs:
if isinstance(sarg, six.string_types):
new_sargs[sarg] = sarg
else:
new_sargs[repr(sarg)] = sarg
sargs = new_sargs
rep = open_line(title)
for key in sargs:
allargs = [farg, sargs[key]]
Expand Down
3 changes: 3 additions & 0 deletions scripts/mcdo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import shutil
import six
import xarray as xr
import sys

sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from env.site_settings import onCiclad, onSpirit
from env.clogging import clogger, clog
Expand Down
37 changes: 34 additions & 3 deletions tests/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,41 @@ def tearDown(self):

class FlineTests(unittest.TestCase):

@unittest.skipUnless(False, "Not implemented")
def test_fline(self):
# TODO: Implement the tests
pass
def my_func(*args):
print(args)
return str(args)

rep = fline(my_func, 'COD', ['EurNland', 'EurSland', 'AtlOce', 'MedSea'], title="Seasonal cycle (1)",
common_args=['AERmon', [{'id': 'MODIS',
'name': 'MODIS',
'ignore': ['EUC12', 'Scplains'],
'period': '2003-2018',
'var': 'Cloud_Optical_Thickness_Combined_Mean_Mean'}], True],
other_args={'EurNland': ['blue black black black black black black', '0 0 2 16 5 13 15', 0, 40],
'EurSland': ['blue black black black black black black', '0 0 2 16 5 13 15', 0, 40],
'AtlOce': ['blue black black black black black black', '0 0 2 16 5 13 15', 0, 40],
'MedSea': ['blue black black black black black black', '0 0 2 16 5 13 15', 0, 40]})
reference_rep = " <TR>\n" \
" <TH ALIGN=LEFT> <li>Seasonal cycle (1)</li> </TH> \n" \
"<TD ALIGN=RIGHT>('COD', 'EurNland', 'AERmon', [{'id': 'MODIS', 'name': 'MODIS', 'ignore': " \
"['EUC12', 'Scplains'], 'period': '2003-2018', 'var': " \
"'Cloud_Optical_Thickness_Combined_Mean_Mean'}], True, " \
"'blue black black black black black black', '0 0 2 16 5 13 15', 0, 40)</TD>\n" \
"<TD ALIGN=RIGHT>('COD', 'EurSland', 'AERmon', [{'id': 'MODIS', 'name': 'MODIS', 'ignore': " \
"['EUC12', 'Scplains'], 'period': '2003-2018', 'var': " \
"'Cloud_Optical_Thickness_Combined_Mean_Mean'}], True, " \
"'blue black black black black black black', '0 0 2 16 5 13 15', 0, 40)</TD>\n" \
"<TD ALIGN=RIGHT>('COD', 'AtlOce', 'AERmon', [{'id': 'MODIS', 'name': 'MODIS', 'ignore': " \
"['EUC12', 'Scplains'], 'period': '2003-2018', 'var': " \
"'Cloud_Optical_Thickness_Combined_Mean_Mean'}], True, " \
"'blue black black black black black black', '0 0 2 16 5 13 15', 0, 40)</TD>\n" \
"<TD ALIGN=RIGHT>('COD', 'MedSea', 'AERmon', [{'id': 'MODIS', 'name': 'MODIS', 'ignore': " \
"['EUC12', 'Scplains'], 'period': '2003-2018', 'var': " \
"'Cloud_Optical_Thickness_Combined_Mean_Mean'}], True, " \
"'blue black black black black black black', '0 0 2 16 5 13 15', 0, 40)</TD>\n " \
"</TR>\n"
self.assertEqual(rep, reference_rep)

def tearDown(self):
craz()
Expand Down

0 comments on commit b05ca4f

Please sign in to comment.