Use set literals

This commit is contained in:
Hugo
2018-01-04 18:17:35 +02:00
parent 3644c72efe
commit 3e8cd9f128
7 changed files with 9 additions and 9 deletions

View File

@@ -56,7 +56,7 @@ class TestSetupReadline(unittest.TestCase):
string = 'os.path.join("a").upper'
assert self.completions(string) == [string]
c = set(['os.' + d for d in dir(os) if d.startswith('ch')])
c = {'os.' + d for d in dir(os) if d.startswith('ch')}
assert set(self.completions('os.ch')) == set(c)
finally:
del self.namespace.sys
@@ -73,7 +73,7 @@ class TestSetupReadline(unittest.TestCase):
import os
s = 'from os import '
goal = set([s + el for el in dir(os)])
goal = {s + el for el in dir(os)}
# There are minor differences, e.g. the dir doesn't include deleted
# items as well as items that are not only available on linux.
assert len(set(self.completions(s)).symmetric_difference(goal)) < 20
@@ -85,7 +85,7 @@ class TestSetupReadline(unittest.TestCase):
def test_preexisting_values(self):
self.namespace.a = range(10)
assert set(self.completions('a.')) == set(['a.' + n for n in dir(range(1))])
assert set(self.completions('a.')) == {'a.' + n for n in dir(range(1))}
del self.namespace.a
def test_colorama(self):