Skip to content

Commit

Permalink
Fix two more OSS test failures.
Browse files Browse the repository at this point in the history
* self.assertCountEqual does not exist in Python 2.
* Dictionaries are not insertion ordered in Python 3.5.

PiperOrigin-RevId: 304261311
  • Loading branch information
rchen152 committed Apr 2, 2020
1 parent 6142b60 commit 729fc21
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pytype/annotations_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def convert_class_annotations(self, node, raw_annotations):
"""Convert a name -> raw_annot dict to annotations."""
annotations = {}
raw_items = raw_annotations.items()
if sys.version_info.major == 2:
if sys.version_info[:2] < (3, 6):
# Make sure annotation errors are reported in a deterministic order.
raw_items = sorted(raw_items)
for name, t in raw_items:
Expand Down
3 changes: 2 additions & 1 deletion pytype/tests/test_base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pytype import utils
from pytype.tests import test_base
from pytype.tests import test_utils
import six


class ErrorLogTest(test_base.TargetIndependentTest):
Expand Down Expand Up @@ -36,7 +37,7 @@ def test_multiple_errors_one_line(self):
line = self._lineno(1)
self.assertEqual(err.expected, {line: [("attribute-error", "e1"),
("attribute-error", "e2")]})
self.assertCountEqual(err.marks, ["e1", "e2"])
six.assertCountEqual(self, err.marks, ["e1", "e2"])
self.assertIn("on int", err.marks["e1"].message)
self.assertIn("on str", err.marks["e2"].message)

Expand Down

0 comments on commit 729fc21

Please sign in to comment.