Пример #1
0
 def test_getFullString(self):
     instance = StackExchangeQueryString()
     instance.addPair("tagged", "ptvs")
     instance.addTag("python")
     self.assertRegex(
         instance.getFullString(),
         '(tagged=ptvs;python&site=stackoverflow)|(site=stackoverflow&tagged=ptvs;python)'
     )
Пример #2
0
 def test_tagCount(self):
     params = {"tagged": "ptvs;ironpython"}
     instance = StackExchangeQueryString(params)
     self.assertEqual(instance._tagCount, 2)
     instance.addTag("debug")
     self.assertEqual(instance._tagCount, 3)
     instance.removeTag('ptvs')
     self.assertEqual(2, instance._tagCount)
     instance.removeTag('debug')
     instance.removeTag('ironpython')
     self.assertEqual(0, instance._tagCount)
Пример #3
0
 def test_addTag(self):
     params = {"tagged": "ptvs"}
     instance = StackExchangeQueryString(params)
     instance.addTag("ironpython")
     self.assertNotIn("django", instance.retrieve("tagged"))
     self.assertIn("ironpython", instance.retrieve("tagged"))
     instance.addTag("django")
     self.assertIn("django", instance.retrieve("tagged"))
     instance.addTag("fourth")
     instance.addTag("fifth")
     self.assertFalse(
         instance.addTag("sixth"))  # separams.MAX_TAGS currently set to 5