-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'vidartf/topic-ufl2unicode'
- Loading branch information
Showing
5 changed files
with
810 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
from six import text_type | ||
|
||
from ufl.algorithms import compute_form_data | ||
from ufl.formatting.ufl2unicode import form2unicode | ||
|
||
|
||
def valid_forms(forms_list): | ||
forms = [] | ||
form_datas = [] | ||
for f in forms_list: | ||
fd = None | ||
try: | ||
fd = compute_form_data(f) | ||
except: | ||
fd = None | ||
if fd is not None: | ||
forms.append(f) | ||
form_datas.append(fd) | ||
return forms, form_datas | ||
|
||
|
||
def test_convert_examples(example_files): | ||
# Get example forms that can be analysed | ||
forms, form_datas = valid_forms(example_files.forms) | ||
if not forms: | ||
return | ||
|
||
# Mainly tests for execution without errors | ||
data = [] | ||
for form, form_data in zip(forms, form_datas): | ||
tmp = form2unicode(form, form_data) | ||
data.append(tmp) | ||
rendered = u"\n\n".join(data) | ||
assert isinstance(rendered, text_type) | ||
assert len(rendered) |
Oops, something went wrong.