Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Side by Side Diff: tools/web_bluetooth/compact_blocklist_unittest.py

Issue 2554253002: bluetooth: web: Rename Blacklist to Blocklist (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/web_bluetooth/compact_blocklist.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import collections 6 import collections
7 import compact_blacklist as cb 7 import compact_blocklist as cb
8 import unittest 8 import unittest
9 9
10 10
11 class CompactBlacklistTest(unittest.TestCase): 11 class CompactBlocklistTest(unittest.TestCase):
12 def TestValidUUID(self): 12 def TestValidUUID(self):
13 self.assertTrue( cb.ValidUUID('00000000-0000-0000-0000-000000000000')) 13 self.assertTrue( cb.ValidUUID('00000000-0000-0000-0000-000000000000'))
14 self.assertTrue( cb.ValidUUID('01234567-89ab-cdef-0123-456789abcdef')) 14 self.assertTrue( cb.ValidUUID('01234567-89ab-cdef-0123-456789abcdef'))
15 self.assertTrue( cb.ValidUUID('00001812-0000-1000-8000-00805f9b34fb')) 15 self.assertTrue( cb.ValidUUID('00001812-0000-1000-8000-00805f9b34fb'))
16 self.assertFalse(cb.ValidUUID('g1234567-89ab-cdef-0123-456789abcdef')) 16 self.assertFalse(cb.ValidUUID('g1234567-89ab-cdef-0123-456789abcdef'))
17 self.assertFalse(cb.ValidUUID('01234567-89ab-cdef-0123-456789abcdef0')) 17 self.assertFalse(cb.ValidUUID('01234567-89ab-cdef-0123-456789abcdef0'))
18 self.assertFalse(cb.ValidUUID('0123456789abcdef0123456789abcdef')) 18 self.assertFalse(cb.ValidUUID('0123456789abcdef0123456789abcdef'))
19 self.assertFalse(cb.ValidUUID('01234567089ab0cdef001230456789abcdef')) 19 self.assertFalse(cb.ValidUUID('01234567089ab0cdef001230456789abcdef'))
20 20
21 def TestShortenUUID(self): 21 def TestShortenUUID(self):
(...skipping 13 matching lines...) Expand all
35 '01234567-89ab-cdef-0123-456789abcdef0'), 35 '01234567-89ab-cdef-0123-456789abcdef0'),
36 '01234567-89ab-cdef-0123-456789abcdef0') 36 '01234567-89ab-cdef-0123-456789abcdef0')
37 self.assertEqual(cb.ShortenUUID( 37 self.assertEqual(cb.ShortenUUID(
38 '0123456789abcdef0123456789abcdef'), 38 '0123456789abcdef0123456789abcdef'),
39 '0123456789abcdef0123456789abcdef') 39 '0123456789abcdef0123456789abcdef')
40 self.assertEqual(cb.ShortenUUID( 40 self.assertEqual(cb.ShortenUUID(
41 '01234567089ab0cdef001230456789abcdef'), 41 '01234567089ab0cdef001230456789abcdef'),
42 '01234567089ab0cdef001230456789abcdef') 42 '01234567089ab0cdef001230456789abcdef')
43 43
44 def TestProcess(self): 44 def TestProcess(self):
45 blacklist = collections.OrderedDict() 45 blocklist = collections.OrderedDict()
46 try: 46 try:
47 cb.Process('# comment', blacklist) 47 cb.Process('# comment', blocklist)
48 cb.Process('', blacklist) 48 cb.Process('', blocklist)
49 except Exception: 49 except Exception:
50 self.fail('Failed test for comment or blank line.') 50 self.fail('Failed test for comment or blank line.')
51 51
52 self.assertRaises(cb.BadLineException, cb.Process, 52 self.assertRaises(cb.BadLineException, cb.Process,
53 '00001812-0000-1000-8000-00805f9b34fb exclude-write exclude', blacklist) 53 '00001812-0000-1000-8000-00805f9b34fb exclude-write exclude', blocklist)
54 self.assertRaises(cb.InvalidExclusionException, cb.Process, 54 self.assertRaises(cb.InvalidExclusionException, cb.Process,
55 '00001812-0000-1000-8000-00805f9b34fb exclude-write', blacklist) 55 '00001812-0000-1000-8000-00805f9b34fb exclude-write', blocklist)
56 self.assertRaises(cb.InvalidExclusionException, cb.Process, 56 self.assertRaises(cb.InvalidExclusionException, cb.Process,
57 '00001812-0000-1000-8000-00805f9b34fb exclude', blacklist) 57 '00001812-0000-1000-8000-00805f9b34fb exclude', blocklist)
58 58
59 try: 59 try:
60 cb.Process('00001812-0000-1000-8000-00805f9b34fa exclude-writes', 60 cb.Process('00001812-0000-1000-8000-00805f9b34fa exclude-writes',
61 blacklist) 61 blocklist)
62 cb.Process('00001812-0000-1000-8000-00805f9b34fb exclude-reads', 62 cb.Process('00001812-0000-1000-8000-00805f9b34fb exclude-reads',
63 blacklist) 63 blocklist)
64 cb.Process('00001812-0000-1000-8000-00805f9b34fc', blacklist) 64 cb.Process('00001812-0000-1000-8000-00805f9b34fc', blocklist)
65 except Exception: 65 except Exception:
66 self.fail('Failed test for valid lines.') 66 self.fail('Failed test for valid lines.')
67 67
68 self.assertRaises(cb.DuplicateUUIDException, cb.Process, 68 self.assertRaises(cb.DuplicateUUIDException, cb.Process,
69 '00001812-0000-1000-8000-00805f9b34fa exclude-writes', blacklist) 69 '00001812-0000-1000-8000-00805f9b34fa exclude-writes', blocklist)
70 70
71 71
72 if __name__ == '__main__': 72 if __name__ == '__main__':
73 unittest.main() 73 unittest.main()
OLDNEW
« no previous file with comments | « tools/web_bluetooth/compact_blocklist.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698