From a541781ee06588ceac17791e5a107065a3fb5f20 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 26 Feb 2021 09:43:58 +0100 Subject: [PATCH] [FIX] test proxy recordset union / concatenation Apparently I wrote this when I was a dumbshit and did not think that Python sets are implemented completely separately from dicts and *remain unordered*. As a result, the simplistic set union would not properly conserve record order, which it should. --- conftest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/conftest.py b/conftest.py index c794257c..959cee42 100644 --- a/conftest.py +++ b/conftest.py @@ -1123,7 +1123,11 @@ class Model: if not isinstance(other, Model) or self._model != other._model: return NotImplemented - return Model(self._env, self._model, {*self._ids, *other._ids}, fields=self._fields) + return Model( + self._env, self._model, + self._ids + tuple(id_ for id_ in other.ids if id_ not in self._ids), + fields=self._fields + ) __add__ = __or__ def __and__(self, other):