def test_destructive() -> None:
    positive_test(
        items={
            get_random_string(length=5): get_random_string(length=5)
            for _ in range(10_000)
        })

    positive_test(items={get_random_string(length=10_000): "v"})
def test_destructive() -> None:
    positive_test(key="k" * 10_000, value="v")
    positive_test(key="k", value="v" * 10_000)
    positive_test(key="k" * 10_000, value="v" * 10_000)

    positive_test(key=get_random_string(length=10_000), value="v")
    positive_test(key="k", value=get_random_string(length=10_000))
    positive_test(key=get_random_string(length=10_000),
                  value=get_random_string(length=10_000))
예제 #3
0
파일: note.py 프로젝트: Viperey/upMoodle
 def test_createNote_length_overflows(self):
     self.login()
     pk = 1
     # Topic
     response = self.client.post('/note/', {'topic': get_random_string(2001), 'text': 'text', 'level_id': 1})
     assert_error_response(response, ErrorMessage.Type.INCORRECT_DATA)
     # Text
     response = self.client.post('/note/', {'topic': 'topic', 'text': get_random_string(2001), 'level_id': 1})
     assert_error_response(response, ErrorMessage.Type.INCORRECT_DATA)
def test_error_rate(filter_, acceptable_error_rate):
    strings_to_add = set(get_random_string(3, 9) for _ in range(CAPACITY))
    strings_to_check = set(get_random_string(3, 9) for _ in range(CAPACITY))
    strings_to_check -= strings_to_add

    for s in strings_to_add:
        filter_.add(s)

    false_positives_count = 0
    for s in strings_to_check:
        if s in filter_:
            false_positives_count += 1

    true_error_rate = false_positives_count / len(strings_to_check)

    print(filter_.__class__.__name__, true_error_rate, acceptable_error_rate)
    assert true_error_rate <= acceptable_error_rate
예제 #5
0
파일: level.py 프로젝트: Viperey/upMoodle
 def _create_random_note(self, level_id=0):
     topic = 'Create' + utils.get_random_string(10)
     response = self.client.post('/note/', {
         'topic': topic,
         'text': 'text',
         'level_id': level_id
     })
     self.assertEqual(response.status_code, 201)
            "loc": ["body", "key"],
            "msg": "str type expected",
            "type": "type_error.str"
        }]
    }
    assert 0.1 > execution_time


def test_destructive() -> None:
    positive_test(
        items={
            get_random_string(length=5): get_random_string(length=5)
            for _ in range(10_000)
        })

    positive_test(items={get_random_string(length=10_000): "v"})
    positive_test(items={"k": get_random_string(length=10_000)})
    positive_test(
        items={
            get_random_string(length=10_000): get_random_string(length=10_000)
        })


if __name__ == "__main__":
    import logging

    logging.basicConfig(level=logging.INFO)
    test_positive()
    test_negative()
    test_destructive()
예제 #7
0
def test_destructive() -> None:
    positive_test(keys=[get_random_string(length=10_000)])
    positive_test(keys=["v" for _ in range(10_000)])
    positive_test(keys=[get_random_string(length=1) for _ in range(10_000)])