8000 contains_only seems to be not working · Issue #77 · assertpy/assertpy · GitHub
[go: up one dir, main page]

Skip to content

contains_only seems to be not working  #77

@marooned071

Description

@marooned071

Hi,

I'm having trouble with contains_only method from assertpy. My understanding is that this assertion should check if two iterables has same elements: is set(list1) equal to set(list2). In fact, this method is checking if iterable under tests is a subset of an argument of contains_only. assertpy version is 0.12

import unittest
from assertpy import assert_that

class AssertPyTestContainsOnly(unittest.TestCase):
    def test_contains_only(self):
        some_list = ["a", "b", "c"]
        assert_that(some_list).contains_only("x", "a", "b", "c")

This test is passing but some_list doesn't contain x. Is should it behave like this? If yes, the name is quite misleading.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0