예제 #1
0
 def test_get_tags(self):
     g = NetworkGraph()
     g.tag('user', 'bernard', 'alex', 'leadership', 'change management')
     g.tag('content', 'doc1', 'caroline', 'leadership', 'negotiations')
     g.tag('content', 'doc1', 'alex', 'negotiations')
     tags = g.unpack(g.get_tags('content', 'doc1', 'caroline'))
     self.assertEqual(tags, ['leadership', 'negotiations'])
예제 #2
0
 def test_get_tags(self):
     g = NetworkGraph()
     g.tag('user', 'bernard', 'alex', 'leadership', 'change management')
     g.tag('content', 'doc1', 'caroline', 'leadership', 'negotiations')
     g.tag('content', 'doc1', 'alex', 'negotiations')
     tags = g.unpack(g.get_tags('content', 'doc1', 'caroline'))
     self.assertEqual(tags, ['leadership', 'negotiations'])
예제 #3
0
 def test_user_tag_untag(self):
     g = NetworkGraph()
     g.tag('user', 'bernard', 'alex', 'leadership', 'change management')
     g.untag('user', 'bernard', 'alex', 'leadership')
     self.assertEqual(['change management'],
                      list(g.get_tags('user', 'bernard', 'alex')))
예제 #4
0
 def test_user_tag_multi(self):
     g = NetworkGraph()
     # alex tags bernard with 'leadership' and 'change management'
     g.tag('user', 'bernard', 'alex', 'leadership', 'change management')
     self.assertEqual(['change management', 'leadership'],
                      sorted(list(g.get_tags('user', 'bernard', 'alex'))))
예제 #5
0
 def test_user_tag_utf8(self):
     g = NetworkGraph()
     # alex tags bernard with 'leadership'
     g.tag('user', u'bernard ♥', u'alex ☀', u'leadership ☃')
     self.assertEqual([u'leadership ☃'],
                      list(g.get_tags('user', u'bernard ♥', u'alex ☀')))
예제 #6
0
 def test_user_tag(self):
     g = NetworkGraph()
     # alex tags bernard with 'leadership'
     g.tag('user', 'bernard', 'alex', 'leadership')
     self.assertEqual(['leadership'],
                      list(g.get_tags('user', 'bernard', 'alex')))
예제 #7
0
 def test_user_tag_untag(self):
     g = NetworkGraph()
     g.tag('user', 'bernard', 'alex', 'leadership', 'change management')
     g.untag('user', 'bernard', 'alex', 'leadership')
     self.assertEqual(['change management'],
                      list(g.get_tags('user', 'bernard', 'alex')))
예제 #8
0
 def test_user_tag_multi(self):
     g = NetworkGraph()
     # alex tags bernard with 'leadership' and 'change management'
     g.tag('user', 'bernard', 'alex', 'leadership', 'change management')
     self.assertEqual(['change management', 'leadership'],
                      sorted(list(g.get_tags('user', 'bernard', 'alex'))))
예제 #9
0
 def test_user_tag_utf8(self):
     g = NetworkGraph()
     # alex tags bernard with 'leadership'
     g.tag('user', u'bernard ♥', u'alex ☀', u'leadership ☃')
     self.assertEqual([u'leadership ☃'],
                      list(g.get_tags('user', u'bernard ♥', u'alex ☀')))
예제 #10
0
 def test_user_tag(self):
     g = NetworkGraph()
     # alex tags bernard with 'leadership'
     g.tag('user', 'bernard', 'alex', 'leadership')
     self.assertEqual(['leadership'],
                      list(g.get_tags('user', 'bernard', 'alex')))