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

Side by Side Diff: client/libs/logdog/tests/streamname_test.py

Issue 1961603002: Add LogDog Python client library. (Closed) Base URL: https://github.com/luci/luci-py@master
Patch Set: Updated w/ comments. Created 4 years, 7 months 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
OLDNEW
(Empty)
1 # Copyright 2016 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed by the Apache v2.0 license that can be
3 # found in the LICENSE file.
4
5 import unittest
6 import itertools
7 import StringIO
8
9 from client.libs.logdog import streamname
10
11
12 class StreamNameTestCase(unittest.TestCase):
13
14 def testInvalidStreamNamesRaiseValueError(self):
15 for name in (
16 '',
17 'a' * (streamname._MAX_STREAM_NAME_LENGTH+1),
18 ' s p a c e s ',
19 '-hyphen',
20 'stream/path/+/not/name',
21 ):
22 with self.assertRaises(ValueError):
23 streamname.validate_stream_name(name)
24
25 def testValidStreamNamesDoNotRaise(self):
26 for name in (
27 'a',
28 'a' * (streamname._MAX_STREAM_NAME_LENGTH),
29 'foo/bar',
30 'f123/four/five-_.:',
31 ):
32 raised = False
33 try:
34 streamname.validate_stream_name(name)
35 except ValueError:
36 raised = True
37 self.assertFalse(raised, "Stream name '%s' raised ValueError" % (name,))
38
39
40 if __name__ == '__main__':
41 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698