Пример #1
0
    def setUp(self):
        QueueDatabaseTest.setUp(self)
        # registration for all the editors below
        self.r = r = 20150101000000
        # exactly 30 days after registration
        self.m = m = 20150131000000
        self.r_plus_30 = format_pretty_date(d(self.m))

        self.create_test_cohort(
            editor_count=5,
            revisions_per_editor=8,
            revision_timestamps=[
                # this one will make 5 edits within 30 days of self.r_plus_30
                [r + 1, r + 2, r + 3, r + 4, r + 5, m + 6, m + 7, m + 8],
                # this one will make 3 edits within 30 days of self.r_plus_30
                [r + 1, r + 2, r + 3, m + 4, m + 5, m + 6, m + 7, m + 8],
                # this one will make 8 edits within 30 days of self.r_plus_30
                [r + 1, r + 2, r + 3, r + 4, r + 5, r + 6, r + 7, r + 8],
                # this one will make 0 edits within 30 days of self.r_plus_30
                [m + 1, m + 2, m + 3, m + 4, m + 5, m + 6, m + 7, m + 8],
                # this one will make the 5th edit right on self.r_plus_30
                [r + 1, r + 2, r + 3, r + 4, m + 0, m + 6, m + 7, m + 8],
            ],
            user_registrations=r,
            revision_lengths=10
        )
    def setUp(self):
        DatabaseTest.setUp(self)

        # registration for all the editors below
        self.before_r = before_r = 20131201000000
        self.r = r = 20140101000000
        # exactly 30 days after registration
        self.m = m = 20140131000000
        # exactly 60 days after registration
        self.m2 = m2 = 20140302000000
        self.r_plus_60 = s(d(self.m2))
        self.editor_count = 14

        self.create_test_cohort(
            # 5 editors will have registered on time, 5 will not
            editor_count=self.editor_count,
            revisions_per_editor=10,
            revision_timestamps=[
                # NOTE: these first 6 are registered BEFORE r
                # this one will make 7 edits within 30 days of m, 3 after
                [r] * 7 + [m + 1] * 3,
                # this one will make 3 edits within 30 days of m, 7 after
                [r] * 3 + [m + 1] * 7,
                # this one will make 10 edits within 30 days of m, 0 after
                [r] * 10,
                # this one will make 0 edits within 30 days of m, 10 after
                [m + 1] * 10,
                # this one will make 5 edits within 30 days of m, 5 after
                [r] * 5 + [m + 1] * 5,
                # this one will make the 5th edit right on m, 5 after
                [r] * 4 + [m] + [m + 1] * 5,
                # this one will make no edits within r -> r + 60 days
                [m2 + 1] * 10,

                # NOTE: these next 6 are registered AFTER r
                # this one will make 7 edits within 30 days of m, 3 after
                [r] * 7 + [m + 1] * 3,
                # this one will make 3 edits within 30 days of m, 7 after
                [r] * 3 + [m + 1] * 7,
                # this one will make 10 edits within 30 days of m, 0 after
                [r] * 10,
                # this one will make 0 edits within 30 days of m, 10 after
                [m + 1] * 10,
                # this one will make 5 edits within 30 days of m, 5 after
                [r] * 5 + [m + 1] * 5,
                # this one will make the 5th edit right on m, 5 after
                [r] * 4 + [m] + [m + 1] * 5,
                # this one will make no edits within r -> r + 60 days
                [m2 + 1] * 10,
            ],
            user_registrations=([before_r] * 7) + ([r] * 7),
            revision_lengths=10
        )
        self.create_non_editors([
            (r, 'newusers', 'create'),
            (r, 'newusers', 'create'),
            (m, 'newusers', 'create'),
        ])
Пример #3
0
    def setUp(self):
        DatabaseTest.setUp(self)

        # registration for all the editors below
        self.before_r = before_r = 20131201000000
        self.r = r = 20140101000000
        # exactly 30 days after registration
        self.m = m = 20140131000000
        # exactly 60 days after registration
        self.m2 = m2 = 20140302000000
        self.r_plus_60 = s(d(self.m2))
        self.editor_count = 14

        self.create_test_cohort(
            # 5 editors will have registered on time, 5 will not
            editor_count=self.editor_count,
            revisions_per_editor=10,
            revision_timestamps=[
                # NOTE: these first 6 are registered BEFORE r
                # this one will make 7 edits within 30 days of m, 3 after
                [r] * 7 + [m + 1] * 3,
                # this one will make 3 edits within 30 days of m, 7 after
                [r] * 3 + [m + 1] * 7,
                # this one will make 10 edits within 30 days of m, 0 after
                [r] * 10,
                # this one will make 0 edits within 30 days of m, 10 after
                [m + 1] * 10,
                # this one will make 5 edits within 30 days of m, 5 after
                [r] * 5 + [m + 1] * 5,
                # this one will make the 5th edit right on m, 5 after
                [r] * 4 + [m] + [m + 1] * 5,
                # this one will make no edits within r -> r + 60 days
                [m2 + 1] * 10,

                # NOTE: these next 6 are registered AFTER r
                # this one will make 7 edits within 30 days of m, 3 after
                [r] * 7 + [m + 1] * 3,
                # this one will make 3 edits within 30 days of m, 7 after
                [r] * 3 + [m + 1] * 7,
                # this one will make 10 edits within 30 days of m, 0 after
                [r] * 10,
                # this one will make 0 edits within 30 days of m, 10 after
                [m + 1] * 10,
                # this one will make 5 edits within 30 days of m, 5 after
                [r] * 5 + [m + 1] * 5,
                # this one will make the 5th edit right on m, 5 after
                [r] * 4 + [m] + [m + 1] * 5,
                # this one will make no edits within r -> r + 60 days
                [m2 + 1] * 10,
            ],
            user_registrations=([before_r] * 7) + ([r] * 7),
            revision_lengths=10)
        self.create_non_editors([
            (r, 'newusers', 'create'),
            (r, 'newusers', 'create'),
            (m, 'newusers', 'create'),
        ])
    def setUp(self):
        DatabaseTest.setUp(self)

        # registration for all the editors below
        self.before_r = before_r = 20131201000000
        self.r = r = 20140101000000
        # exactly 30 days after registration
        self.m = m = 20140131000000
        self.r_plus_30 = s(d(self.m))
        self.editor_count = 10

        self.create_test_cohort(
            # 5 editors will have registered on time, 5 will not
            editor_count=self.editor_count,
            revisions_per_editor=8,
            revision_timestamps=[
                # NOTE: these first 5 are registered BEFORE r
                # this one will make 5 edits within 30 days of self.r_plus_30
                [r + 1, r + 2, r + 3, r + 4, r + 5, m + 6, m + 7, m + 8],
                # this one will make 3 edits within 30 days of self.r_plus_30
                [r + 1, r + 2, r + 3, m + 4, m + 5, m + 6, m + 7, m + 8],
                # this one will make 8 edits within 30 days of self.r_plus_30
                [r + 1, r + 2, r + 3, r + 4, r + 5, r + 6, r + 7, r + 8],
                # this one will make 0 edits within 30 days of self.r_plus_30
                [m + 1, m + 2, m + 3, m + 4, m + 5, m + 6, m + 7, m + 8],
                # this one will make the 5th edit right on self.r_plus_30
                [r + 1, r + 2, r + 3, r + 4, m + 0, m + 6, m + 7, m + 8],

                # NOTE: these next 5 are registered AFTER r
                # this one will make 5 edits within 30 days of self.r_plus_30
                [r + 1, r + 2, r + 3, r + 4, r + 5, m + 6, m + 7, m + 8],
                # this one will make 3 edits within 30 days of self.r_plus_30
                [r + 1, r + 2, r + 3, m + 4, m + 5, m + 6, m + 7, m + 8],
                # this one will make 8 edits within 30 days of self.r_plus_30
                [r + 1, r + 2, r + 3, r + 4, r + 5, r + 6, r + 7, r + 8],
                # this one will make 0 edits within 30 days of self.r_plus_30
                [m + 1, m + 2, m + 3, m + 4, m + 5, m + 6, m + 7, m + 8],
                # this one will make the 5th edit right on self.r_plus_30
                [r + 1, r + 2, r + 3, r + 4, m + 0, m + 6, m + 7, m + 8],
            ],
            user_registrations=([before_r] * 5) + ([r] * 5),
            revision_lengths=10
        )
        self.create_non_editors([
            (r, 'newusers', 'create'),
            (r, 'newusers', 'create'),
            (m, 'newusers', 'create'),
        ])
    def setUp(self):
        DatabaseTest.setUp(self)

        # registration for all the editors below
        self.before_r = before_r = 20131201000000
        self.r = r = 20140101000000
        # exactly 30 days after registration
        self.m = m = 20140131000000
        self.r_plus_30 = s(d(self.m))
        self.editor_count = 10

        self.create_test_cohort(
            # 5 editors will have registered on time, 5 will not
            editor_count=self.editor_count,
            revisions_per_editor=8,
            revision_timestamps=[
                # NOTE: these first 5 are registered BEFORE r
                # this one will make 5 edits within 30 days of self.r_plus_30
                [r + 1, r + 2, r + 3, r + 4, r + 5, m + 6, m + 7, m + 8],
                # this one will make 3 edits within 30 days of self.r_plus_30
                [r + 1, r + 2, r + 3, m + 4, m + 5, m + 6, m + 7, m + 8],
                # this one will make 8 edits within 30 days of self.r_plus_30
                [r + 1, r + 2, r + 3, r + 4, r + 5, r + 6, r + 7, r + 8],
                # this one will make 0 edits within 30 days of self.r_plus_30
                [m + 1, m + 2, m + 3, m + 4, m + 5, m + 6, m + 7, m + 8],
                # this one will make the 5th edit right on self.r_plus_30
                [r + 1, r + 2, r + 3, r + 4, m + 0, m + 6, m + 7, m + 8],

                # NOTE: these next 5 are registered AFTER r
                # this one will make 5 edits within 30 days of self.r_plus_30
                [r + 1, r + 2, r + 3, r + 4, r + 5, m + 6, m + 7, m + 8],
                # this one will make 3 edits within 30 days of self.r_plus_30
                [r + 1, r + 2, r + 3, m + 4, m + 5, m + 6, m + 7, m + 8],
                # this one will make 8 edits within 30 days of self.r_plus_30
                [r + 1, r + 2, r + 3, r + 4, r + 5, r + 6, r + 7, r + 8],
                # this one will make 0 edits within 30 days of self.r_plus_30
                [m + 1, m + 2, m + 3, m + 4, m + 5, m + 6, m + 7, m + 8],
                # this one will make the 5th edit right on self.r_plus_30
                [r + 1, r + 2, r + 3, r + 4, m + 0, m + 6, m + 7, m + 8],
            ],
            user_registrations=([before_r] * 5) + ([r] * 5),
            revision_lengths=10)
        self.create_non_editors([
            (r, 'newusers', 'create'),
            (r, 'newusers', 'create'),
            (m, 'newusers', 'create'),
        ])
Пример #6
0
 def setUp(self):
     self.editor_count    = 100000
     self.revision_count  = 2
     
     one_hour = timedelta(hours=1)
     start = datetime.now() - one_hour * self.editor_count * 2
     
     timestamps = [
         [i(start + one_hour * (rev + edi)) for rev in range(self.revision_count)]
         for edi in range(self.editor_count)
     ]
     
     DatabaseTest.setUp(self)
     self.create_test_cohort(
         editor_count=self.editor_count,
         revisions_per_editor=self.revision_count,
         user_registrations=[i(d(t[0]) - one_hour) for t in timestamps],
         revision_timestamps=timestamps,
         revision_lengths=10,
     )
Пример #7
0
    def setUp(self):
        self.editor_count = 100000
        self.revision_count = 2

        one_hour = timedelta(hours=1)
        start = datetime.now() - one_hour * self.editor_count * 2

        timestamps = [[
            i(start + one_hour * (rev + edi))
            for rev in range(self.revision_count)
        ] for edi in range(self.editor_count)]

        DatabaseTest.setUp(self)
        self.create_test_cohort(
            editor_count=self.editor_count,
            revisions_per_editor=self.revision_count,
            user_registrations=[i(d(t[0]) - one_hour) for t in timestamps],
            revision_timestamps=timestamps,
            revision_lengths=10,
        )