Coverage for src/tests/test_difference_with.py: 100%

1 import remedapy as R

2

3

4 class TestDifferenceWith:

5 def test_data_first(self):

6 # R.difference_with(data, other, isEqual);

7 assert list(

8 R.difference_with([{'a': 1}, {'a': 2}, {'a': 3}, {'a': 4}], [2, 5, 3], lambda d, x: d['a'] == x),

9 ) == [{'a': 1}, {'a': 4}]

10

11 def test_data_last(self):

12 # R.difference_with(other, isEqual)(data);

13 def cmp(d: dict[str, int], x: int) -> bool:

14 return d['a'] == x

15

16 assert R.pipe(

17 [{'a': 1}, {'a': 2}, {'a': 3}, {'a': 4}, {'a': 5}, {'a': 6}],

18 R.difference_with([2, 3], cmp),

19 list,

20 ) == [{'a': 1}, {'a': 4}, {'a': 5}, {'a': 6}]