Skip to content

Instantly share code, notes, and snippets.


Martin Thoma MartinThoma

View GitHub Profile
from typing import Dict, Optional
from dataclasses import dataclass
from hypothesis import strategies as st
class PdfInfo:
path: str
is_errornous: bool
is_encrypted: bool
from hypothesis import given, strategies as st
from mpu.datastructures import Interval
@given(st.lists(st.integers(), min_size=4, max_size=4).map(sorted))
def test_interval_issubset(integer_list):
a, b, c, d = integer_list
assert Interval(b, c).issubset(Interval(a, d))
from hypothesis import given, strategies as s
from base64 import b64encode, b64decode
def test_base64_encode_decode_together(data):
assert b64decode(b64encode(data)) == data
import hypothesis.strategies as s
from hypothesis import given
import mpu.string # Martins Python Utilities
def test_is_email(email):
assert mpu.string.is_email(email), f"is_email({email}) returned False"
# Third party
import hypothesis.strategies as s
from hypothesis import given
# First party
from factorize import factorize
@given(s.integers(min_value=-(10 ** 6), max_value=10 ** 6))
def test_factorize_multiplication_property(n):
# Third party modules
import pytest
# First party modules
from factorize import factorize
from typing import List
import math
def factorize(number: int) -> List[int]:
if number in [-1, 0, 1]:
return [number]
if number < 0:
return [-1] + factorize(-number)
factors = []
View pdftotext-extracted.txt
Test document
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed pulvinar nisi quis mauris egestas, maximus
congue tellus tempor. Quisque semper augue consectetur mattis imperdiet. Aliquam elementum, nibh
id scelerisque malesuada, arcu mauris ultricies tellus, non ultrices nulla lacus non erat. Curabitur in
diam a magna ornare finibus. Sed dapibus ipsum laoreet justo eleifend commodo. Nulla porttitor eros
odio, nec cursus mi sagittis eu. Duis metus arcu, auctor gravida interdum sed, congue a velit. Aliquam
malesuada posuere erat sit amet vehicula. Nunc vitae tempus orci. Nulla a elementum magna, vitae
scelerisque nisl. Phasellus gravida elit eu hendrerit tristique. Etiam rutrum ac ipsum vitae consequat.
Nam sit amet gravida arcu. Sed eget dictum lorem, eu consectetur sapien.
View .gitlab-ci.yml
image: python
- test
- pip install pip --upgrade
- pip install -r dev-requirements.txt
View .travis.yml
language: python
- 3.6
- 3.7
- 3.8
- pip install coveralls tox-travis
- tox
You can’t perform that action at this time.