Skip to content

Commit

Permalink
TST: Fix tests for Python 3.6 compatibility
Browse files Browse the repository at this point in the history
While testing examples, positions are not in the expected order.
  • Loading branch information
Peque committed Jan 16, 2020
1 parent b0b20b0 commit 13d3e80
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from functools import partial
from operator import itemgetter
import tarfile

import matplotlib
Expand Down Expand Up @@ -77,11 +78,20 @@ def test_example(self, example_name):
},
)
expected_perf = self.expected_perf[example_name]
# Exclude positions column as the positions do not always have the
# same order
columns = [column for column in examples._cols_to_check
if column != 'positions']
assert_equal(
actual_perf[examples._cols_to_check],
expected_perf[examples._cols_to_check],
actual_perf[columns],
expected_perf[columns],
# There is a difference in the datetime columns in pandas
# 0.16 and 0.17 because in 16 they are object and in 17 they are
# datetime[ns, UTC]. We will just ignore the dtypes for now.
check_dtype=False,
)
# Sort positions by SID before comparing
assert_equal(
expected_perf['positions'].apply(sorted, key=itemgetter('sid')),
actual_perf['positions'].apply(sorted, key=itemgetter('sid')),
)

0 comments on commit 13d3e80

Please sign in to comment.