swob.Match: add __repr__
<swift.common.swob.Match object at 0x7fe589571d50> isn't quite as obvious. Change-Id: I7197e7732a4b56084b45ce6a113bc39ce8c7bd54
This commit is contained in:
parent
baa4fa5d65
commit
77bfe7affa
@ -634,6 +634,10 @@ class Match(object):
|
||||
def __contains__(self, val):
|
||||
return '*' in self.tags or val in self.tags
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%r)' % (
|
||||
self.__class__.__name__, ', '.join(sorted(self.tags)))
|
||||
|
||||
|
||||
class Accept(object):
|
||||
"""
|
||||
|
@ -271,12 +271,14 @@ class TestMatch(unittest.TestCase):
|
||||
self.assertIn('a', match)
|
||||
self.assertIn('b', match)
|
||||
self.assertNotIn('c', match)
|
||||
self.assertEqual(repr(match), "Match('a, b')")
|
||||
|
||||
def test_match_star(self):
|
||||
match = swift.common.swob.Match('"a", "*"')
|
||||
self.assertIn('a', match)
|
||||
self.assertIn('b', match)
|
||||
self.assertIn('c', match)
|
||||
self.assertEqual(repr(match), "Match('*, a')")
|
||||
|
||||
def test_match_noquote(self):
|
||||
match = swift.common.swob.Match('a, b')
|
||||
|
Loading…
Reference in New Issue
Block a user