[test] don't rely on a particular ordering for unsorted lists

Related to #267910.

authorJulien Cristau <julien.cristau@logilab.fr>
changeset8091838787e8
branchdefault
phasepublic
hiddenno
parent revision#8abec5743ecb [test] deal with py3k's string types
child revision#6f52973add43 [constraints] use io.StringIO (wip), #280621720b4e [constraints] fix check_password, #e1e4ba4e19e3 [constraints] update check_password for py3k
files modified by this revision
test/unittest_schema.py
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1413464890 -7200
# Thu Oct 16 15:08:10 2014 +0200
# Node ID 8091838787e802ab9d07e7188b80cf303cc1f027
# Parent 8abec5743ecb75b51ac446ca89f3da2b6295e9c0
[test] don't rely on a particular ordering for unsorted lists

Related to #267910.

diff --git a/test/unittest_schema.py b/test/unittest_schema.py
@@ -216,12 +216,12 @@
1          global schema
2          schema = deepcopy(schema)
3          self.assertFalse(eperson is schema['Person'])
4          self.assertEqual(eperson, schema['Person'])
5          self.assertEqual('Person', schema['Person'])
6 -        self.assertEqual(eperson.subject_relations(), schema['Person'].subject_relations())
7 -        self.assertEqual(eperson.object_relations(), schema['Person'].object_relations())
8 +        self.assertCountEqual(eperson.subject_relations(), schema['Person'].subject_relations())
9 +        self.assertCountEqual(eperson.object_relations(), schema['Person'].object_relations())
10          self.assertEqual(schema.eschema('Person').final, False)
11          self.assertEqual(schema.eschema('String').final, True)
12          self.assertEqual(schema.rschema('ref').final, True)
13          self.assertEqual(schema.rschema('concerne').final, False)
14 
@@ -249,11 +249,11 @@
15 
16      def test_is_metadata(self):
17          self.assertEqual(eperson.is_metadata('promo'), None)
18          self.assertEqual(eperson.is_metadata('promo_enlarged'), None)
19          self.assertEqual(eperson.is_metadata('promo_encoding'), ('promo', 'encoding'))
20 -        self.assertEqual([(k.type, v)  for k, v in eperson.meta_attributes().items()],
21 +        self.assertCountEqual([(k.type, v)  for k, v in eperson.meta_attributes().items()],
22                            [('promo_encoding', ('encoding', 'promo')),
23                             ('promo_format', ('format', 'promo'))])
24 
25      def test_defaults(self):
26          self.assertEqual(list(eperson.defaults()), [])
@@ -267,11 +267,11 @@
27          #                   eperson.vocabulary, 'nom')
28 
29      def test_indexable_attributes(self):
30          eperson.rdef('nom').fulltextindexed = True
31          eperson.rdef('prenom').fulltextindexed = True
32 -        self.assertEqual(list(eperson.indexable_attributes()), ['nom', 'prenom'])
33 +        self.assertCountEqual(list(eperson.indexable_attributes()), ['nom', 'prenom'])
34 
35 
36      def test_goodValues_relation_default(self):
37          """check good values of entity does not raise an exception"""
38          eperson.rdef('nom').default = 'No name'