def test_set_intersection_update(): mock = Mock() observable = observ.ObservableSet({1, 2}) observable.subscribe(mock) observable.intersection_update({2, 3}) mock.assert_called_with(new_value={2})
def test_set_difference_update(): mock = Mock() observable = observ.ObservableSet({1, 2}) observable.subscribe(mock) observable.difference_update({2, 3}) mock.assert_called_with(new_value={1})
def test_set_add(): mock = Mock() observable = observ.ObservableSet() observable.subscribe(mock) observable.add(1) mock.assert_called_with(new_value={1})
def test_set_pop(): mock = Mock() observable = observ.ObservableSet() observable.subscribe(mock) observable.add(1) mock.assert_called_with(new_value={1}) popped = observable.pop() mock.assert_called_with(new_value=set()) assert popped == 1
def test_set_init(): observable = observ.ObservableSet({1, 2, 3}) assert observable == {1, 2, 3}