IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
소스 검색

Add test_cumcount.

master
Stanislaw Adaszewski 3 년 전
부모
커밋
cee0c23bd7
1개의 변경된 파일26개의 추가작업 그리고 0개의 파일을 삭제
  1. +26
    -0
      tests/triacontagon/test_cumcount.py

+ 26
- 0
tests/triacontagon/test_cumcount.py 파일 보기

@@ -0,0 +1,26 @@
from triacontagon.cumcount import dfill, \
argunsort, \
cumcount
import numpy as np
def test_dfill_01():
input = np.array([1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5])
output = dfill(input)
expected = np.array([0, 0, 0, 0, 0, 5, 5, 7, 7, 7, 10, 10, 12, 12])
assert np.all(output == expected)
def test_argunsort_01():
input = np.array([1, 1, 2, 3, 3, 4, 1, 1, 5, 5, 2, 3, 1, 4])
output = np.argsort(input, kind='mergesort')
output = argunsort(output)
expected = np.array([0, 1, 5, 7, 8, 10, 2, 3, 12, 13, 6, 9, 4, 11])
assert np.all(output == expected)
def test_cumcount_01():
input = np.array([1, 1, 2, 3, 3, 4, 1, 1, 5, 5, 2, 3, 1, 4])
output = cumcount(input)
expected = np.array([0, 1, 0, 0, 1, 0, 2, 3, 0, 1, 1, 2, 4, 1])
assert np.all(output == expected)

불러오는 중...
취소
저장