Repository: glotzerlab/signac
Pull request #210 (2019-07-17 16:45:08)

Fix/issue 209
## Description

Fixes issue #209.

## Types of Changes
<!-- Please select all items that apply either now or after creating the pull request: -->
- [ ] Documentation update
- [x] Bug fix
- [ ] New feature
- [ ] Breaking change<sup>1</sup>

<sup>1</sup>The change breaks (or has the potential to break) existing functionality.

## Checklist:
<!-- Please select all items that apply either now or after creating the pull request. -->
<!-- If you are unsure about any of these items, do not hesitate to ask! -->
- [x] I am familiar with the [**Contributing Guidelines**](https://github.com/glotzerlab/signac/blob/master/CONTRIBUTING.md).
- [x] I agree with the terms of the [**Contributor Agreement**](https://github.com/glotzerlab/signac/blob/master/ContributorAgreement.md).
- [x] My name is on the [list of contributors](https://github.com/glotzerlab/signac/blob/master/contributors.txt).
- [x] My code follows the [code style guideline](https://github.com/glotzerlab/signac/blob/master/CONTRIBUTING.md#code-style) of this project.
- [x] The changes introduced by this pull request are covered by existing or newly introduced tests.

If necessary:
- [ ] I have updated the API documentation as part of the package doc-strings.
- [ ] I have created a separate pull request to update the [framework documentation](https://docs.signac.io/) on [signac-docs](https://github.com/glotzerlab/signac-docs) and linked it here.
- [x] I have updated the [changelog](https://github.com/glotzerlab/signac/blob/master/changelog.txt).



Patch:
diff --git a/changelog.txt b/changelog.txt
index 749f38cc..daf2b1c6 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -27,7 +27,7 @@ next
  - Fix issue causing a failure of the automatic conversion of valid key types (#168, #205).
  - Improve the 'dots in keys' error message to make it easier to fix related issues (#170, #205).
  - Update the ``__repr__`` and ``__repr_html__`` implementations of the ``Project`, ``Job``, and ``JobsCursor`` classes (#193).
-
+ - Fix issue with heterogeneous types in state point values that are lists (#209).
 
 [1.1.0] -- 2019-05-19
 ---------------------
diff --git a/signac/contrib/schema.py b/signac/contrib/schema.py
index 0d60120a..cf641a7b 100644
--- a/signac/contrib/schema.py
+++ b/signac/contrib/schema.py
@@ -93,7 +93,10 @@ class ProjectSchema(object):
                 return str(x)
 
         def _fmt_range(type_, values):
-            sorted_values = sorted(values)
+            try:
+                sorted_values = sorted(values)
+            except TypeError:
+                sorted_values = sorted(values, key=repr)
             if len(values) <= max_num_range:
                 values_string = ', '.join((_fmt_value(v) for v in sorted_values))
             else:


Test patch:
diff --git a/tests/test_project.py b/tests/test_project.py
index e9ea86d3..21f89c65 100644
--- a/tests/test_project.py
+++ b/tests/test_project.py
@@ -660,7 +660,7 @@ class ProjectTest(BaseProjectTest):
                 'const2': {'const3': 0},
                 'a': i,
                 'b': {'b2': i},
-                'c': [i, 0, 0],
+                'c': [i if i % 2 else None, 0, 0],
                 'd': [[i, 0, 0]],
                 'e': {'e2': [i, 0, 0]} if i % 2 else 0,  # heterogeneous!
                 'f': {'f2': [[i, 0, 0]]},