Exemple #1
0
    def test_update_with_no_arguments(self):
        s = RedisSet()
        s.update()
        assert s == set()

        s = RedisSet('abcd')
        s.update()
        assert s == {'a', 'b', 'c', 'd'}
Exemple #2
0
    def test_update_with_empty_set(self):
        metasyntactic_variables = RedisSet()
        metasyntactic_variables.update(set())
        assert metasyntactic_variables == set()

        metasyntactic_variables = RedisSet({'foo', 'bar', 'baz'})
        metasyntactic_variables.update(set())
        assert metasyntactic_variables == {'foo', 'bar', 'baz'}
Exemple #3
0
    def test_update_with_empty_set(self):
        metasyntactic_variables = RedisSet()
        metasyntactic_variables.update(set())
        assert metasyntactic_variables == set()

        metasyntactic_variables = RedisSet({'foo', 'bar', 'baz'})
        metasyntactic_variables.update(set())
        assert metasyntactic_variables == {'foo', 'bar', 'baz'}
Exemple #4
0
    def test_update_with_no_arguments(self):
        s = RedisSet()
        s.update()
        assert s == set()

        s = RedisSet('abcd')
        s.update()
        assert s == {'a', 'b', 'c', 'd'}
Exemple #5
0
 def test_update_with_set_and_range(self):
     silliness = RedisSet()
     silliness.update({'foo', 'bar', 'baz'}, range(5))
     assert silliness == {'foo', 'bar', 'baz', 0, 1, 2, 3, 4}
     silliness.update({'qux'}, range(6))
     assert silliness == {'foo', 'bar', 'baz', 'qux', 0, 1, 2, 3, 4, 5}
Exemple #6
0
 def test_update_with_range(self):
     ramanujans_friends = RedisSet()
     ramanujans_friends.update(range(10))
     assert ramanujans_friends == {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
Exemple #7
0
 def test_update_with_set(self):
     metasyntactic_variables = RedisSet()
     metasyntactic_variables.update({'foo', 'bar', 'baz'})
     assert metasyntactic_variables == {'foo', 'bar', 'baz'}
     metasyntactic_variables.update({'qux'})
     assert metasyntactic_variables == {'foo', 'bar', 'baz', 'qux'}
Exemple #8
0
 def test_update_with_set_and_range(self):
     silliness = RedisSet()
     silliness.update({'foo', 'bar', 'baz'}, range(5))
     assert silliness == {'foo', 'bar', 'baz', 0, 1, 2, 3, 4}
     silliness.update({'qux'}, range(6))
     assert silliness == {'foo', 'bar', 'baz', 'qux', 0, 1, 2, 3, 4, 5}
Exemple #9
0
 def test_update_with_range(self):
     ramanujans_friends = RedisSet()
     ramanujans_friends.update(range(10))
     assert ramanujans_friends == {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
Exemple #10
0
 def test_update_with_set(self):
     metasyntactic_variables = RedisSet()
     metasyntactic_variables.update({'foo', 'bar', 'baz'})
     assert metasyntactic_variables == {'foo', 'bar', 'baz'}
     metasyntactic_variables.update({'qux'})
     assert metasyntactic_variables == {'foo', 'bar', 'baz', 'qux'}