def test_add_operator():
	assert frozensetlist(range(2)) + frozensetlist([2]) == frozensetlist(range(3))
	assert setlist(range(2)) + frozensetlist([2]) == setlist(range(3))
	assert frozensetlist(range(2)) + setlist([2]) == frozensetlist(range(3))
	assert setlist(range(2)) + setlist([2]) == setlist(range(3))
	with pytest.raises(TypeError):
		setlist() + set()
	with pytest.raises(TypeError):
		setlist() + list()
def test_operator_add():
	assert setlist('abc') + setlist('def') == setlist('abcdef')
	with pytest.raises(TypeError):
		assert setlist('abc') + 'def' == setlist('abcdef')
	assert frozensetlist(range(2)) + frozensetlist([2]) == frozensetlist(range(3))
	assert setlist(range(2)) + frozensetlist([2]) == setlist(range(3))
	assert frozensetlist(range(2)) + setlist([2]) == frozensetlist(range(3))
	assert setlist(range(2)) + setlist([2]) == setlist(range(3))
	with pytest.raises(TypeError):
		setlist() + set()
	with pytest.raises(TypeError):
		setlist() + list()
Beispiel #3
0
def test_operator_add():
	assert setlist('abc') + setlist('def') == setlist('abcdef')
	with pytest.raises(TypeError):
		assert setlist('abc') + 'def' == setlist('abcdef')
	assert frozensetlist(range(2)) + frozensetlist([2]) == frozensetlist(range(3))
	assert setlist(range(2)) + frozensetlist([2]) == setlist(range(3))
	assert frozensetlist(range(2)) + setlist([2]) == frozensetlist(range(3))
	assert setlist(range(2)) + setlist([2]) == setlist(range(3))
	with pytest.raises(TypeError):
		setlist() + set()
	with pytest.raises(TypeError):
		setlist() + list()
def test_repr():
	"""Test __repr."""
	assert repr(setlist()) == 'setlist()'
	assert repr(setlist(range(4))) == 'setlist((0, 1, 2, 3))'
	assert repr(frozensetlist()) == 'frozensetlist()'
	assert repr(frozensetlist('abc')) == "frozensetlist(('a', 'b', 'c'))"
def test_str():
	"""Test __str__."""
	assert str(setlist()) == '{[}]'
	assert str(setlist('abc')) == "{['a', 'b', 'c'}]"
	assert str(frozensetlist()) == 'frozensetlist()'
	assert str(frozensetlist('abc')) == "frozensetlist(('a', 'b', 'c'))"
def test_hash_differs_with_order():
	assert hash(frozensetlist('abc')) != hash(frozensetlist('cab'))
def test_hash():
	"""Test __hash__."""
	assert hash(frozensetlist('abc')) == hash(frozensetlist('abc'))
	assert hash(frozensetlist()) == hash(frozensetlist())
def test_repr():
	"""Test __repr."""
	assert repr(setlist()) == 'setlist()'
	assert repr(setlist(range(4))) == 'setlist((0, 1, 2, 3))'
	assert repr(frozensetlist()) == 'frozensetlist()'
	assert repr(frozensetlist('abc')) == "frozensetlist(('a', 'b', 'c'))"
def test_str():
	"""Test __str__."""
	assert str(setlist()) == '{[}]'
	assert str(setlist('abc')) == "{['a', 'b', 'c'}]"
	assert str(frozensetlist()) == 'frozensetlist()'
	assert str(frozensetlist('abc')) == "frozensetlist(('a', 'b', 'c'))"
def test_hash_differs_with_order():
	assert hash(frozensetlist('abc')) != hash(frozensetlist('cab'))
def test_hash():
	"""Test __hash__."""
	assert hash(frozensetlist('abc')) == hash(frozensetlist('abc'))
	assert hash(frozensetlist()) == hash(frozensetlist())
Beispiel #12
0
def test_hash():
    assert hash(frozensetlist('abc')) == hash(frozensetlist('abc'))
    assert hash(frozensetlist()) == hash(frozensetlist())