Example #1
0
    def test_commit_change(self):
        t = STransaction(mockuser(1), 0)
        t.notify(mockuser(15, (0.1, 0.9)))
        t.commit_change()

        assert t.change == (0.1, 0.9)
        assert t.user_score == (0.1, 0.9)
Example #2
0
    def test_update_first_change(self):
        le = SLedger(0)
        t0 = STransaction(mockuser(0), 0)
        t1 = STransaction(mockuser(1), 0)
        t2 = STransaction(mockuser(2), 0)

        t1.notify = MagicMock()

        le.add(t0)
        le.add(t1)
        le.add(t2)

        le.clear_changes()
        le.update(1)

        print(le.changed)
        assert le.first_change == t1
Example #3
0
    def test_calculate_nocommit(self):
        t = STransaction(mockuser(1), 0)
        t.notify(mockuser(15, (0.1, 0.9)))

        assert t.calculate(.12) == .12