Example #1
0
def test_giving_itr_to_bucket_creates_bucket_with_values(priority, iterable):
    """Test that creating a bucket with iterable stores values in bucket."""
    from priorityq import Bucket
    b = Bucket(priority, iterable)
    assert len(b._values) == len(iterable)
Example #2
0
def test_new_bucket_has_priority_and_is_empty():
    """Test that a new bucket has a priority and is empty."""
    from priorityq import Bucket
    b = Bucket(1)
    assert b.priority == 1
    assert len(b._values) == 0
Example #3
0
def test_bucket_with_different_priority_not_equal_to_int():
    """Test that bucket with different priority than int is not equal."""
    from priorityq import Bucket
    b1 = Bucket(1)
    assert b1 != 2
Example #4
0
def test_bucket_with_same_priority_can_be_equal_to_int():
    """Test that bucket with same priority as int are the same."""
    from priorityq import Bucket
    b1 = Bucket(1)
    assert b1 == 1
Example #5
0
def test_comparing_priority_of_buckets_to_int():
    """Test that comparison of bucket priority and int works."""
    from priorityq import Bucket
    b1 = Bucket(1)
    assert b1 > 0
Example #6
0
def test_two_buckets_with_different_priority_not_equal():
    """Test that buckets with different values are not the same."""
    from priorityq import Bucket
    b1 = Bucket(1)
    b2 = Bucket(2)
    assert b1 != b2
Example #7
0
def test_buckets_with_same_priority_are_equal():
    """Test that buckets with same priority are the same."""
    from priorityq import Bucket
    b1 = Bucket(1)
    b2 = Bucket(1)
    assert b1 == b2
Example #8
0
def test_comparing_priority_of_buckets():
    """Test that comparison of two buckets work."""
    from priorityq import Bucket
    b1 = Bucket(1)
    b2 = Bucket(2)
    assert b2 > b1