Beispiel #1
0
    def test_algorithm2(self):

        for service in self.services:
            messages = self.db.messageByService(service)

            for message in messages:
                self.assertEqual(message["service"], service)

            messages.rewind()

            num = Algorithm2.getAlgorithmNumber()
            res = Algorithm2.getResult(messages)
            self.assertIsInstance(num, int)
            self.assertIsInstance(res, float)
Beispiel #2
0
now = time.time()
services = ["Twitter", "Google Plus", "Facebook", "Reddit"]

for service in services:
    messages = db.messageByService(service)
    res = Algorithm1.getResult(messages)
    db.saveResult(now, service, Algorithm1.getAlgorithmNumber(), res)
    total += res

print total

total = 0

for service in services:
    messages = db.messageByService(service)
    res = Algorithm2.getResult(messages)
    db.saveResult(now, service, Algorithm2.getAlgorithmNumber(), res)
    total += res

print total

total = 0

for service in services:
    messages = db.messageByService(service)
    res = Algorithm3.getResult(messages)
    db.saveResult(now, service, Algorithm3.getAlgorithmNumber(), res)
    total += res

print total