[core] Testing and fixing new args/kwargs behaviour.

This commit is contained in:
Romain Dorgueil
2017-10-22 18:00:16 +02:00
parent bc01b5d404
commit 28fe41c0bd
3 changed files with 87 additions and 20 deletions

View File

@ -92,13 +92,28 @@ def test_pickle():
assert unpickled == bag
def test_eq_operator():
def test_eq_operator_bag():
assert Bag('foo') == Bag('foo')
assert Bag('foo') != Bag('bar')
assert Bag('foo') is not Bag('foo')
assert Bag('foo') != Token('foo')
assert Token('foo') != Bag('foo')
def test_eq_operator_tuple_mixed():
assert Bag('foo', bar='baz') == ('foo', {'bar': 'baz'})
assert Bag('foo') == ('foo', {})
assert Bag() == ({}, )
def test_eq_operator_tuple_not_mixed():
assert Bag('foo', 'bar') == ('foo', 'bar')
assert Bag('foo') == ('foo', )
assert Bag() == ()
def test_eq_operator_dict():
assert Bag(foo='bar') == {'foo': 'bar'}
assert Bag(foo='bar', corp='acme') == {'foo': 'bar', 'corp': 'acme', }
assert Bag(foo='bar', corp='acme') == {'corp': 'acme', 'foo': 'bar', }
assert Bag() == {}
def test_repr():
bag = Bag('a', a=1)