/
githubmirror
/
python3-libs
Обзор
Документация
Войти
/
githubmirror
/
python3-libs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tests/test_factoring.py
18 строк
556 B
Björn Lindqvist
a module for factoring numbers
25 июл 2022, 21:59
25 июл 2022, 21:59
8182b7e
Код
Авторство
О чём код?
# Copyright (C) 2022 Björn A. Lindqvist <bjourne@gmail.com> from fractions import Fraction from tools.factoring import factorize_rat def test_factoring(): examples = [ (-2, [(-1, 1), (2, 1)]), (Fraction(1, 8), [(2, -3)]), (-1, [(-1, 1)]), (0, [(0, 1)]), (1, [(1, 1)]), (2, [(2, 1)]), (-100, [(-1, 1), (2, 2), (5, 2)]), (Fraction(1, 2), [(2, -1)]), (-Fraction(1, 2), [(-1, 1), (2, -1)]), ] for input, expected in examples: assert factorize_rat(input) == expected