-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest_make_dataset.py
26 lines (19 loc) · 1010 Bytes
/
test_make_dataset.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#from __future__ import absolute_import
from unittest import TestCase
from make_dataset import parse_rank_specification
class TestParse_rank_specification(TestCase):
def test_basic(self):
self.assertEqual(parse_rank_specification('1'), set([1]))
self.assertEqual(parse_rank_specification('1,2,3'), set([1, 2, 3]))
self.assertEqual(parse_rank_specification('1..3'), set([1, 2, 3]))
self.assertEqual(parse_rank_specification('-1..3'), set([0, 1, 2, 3, -1]))
self.assertEqual(parse_rank_specification('-1..3,5..6'), set([0, 1, 2, 3, 5, 6, -1]))
self.assertEqual(parse_rank_specification('5..5,1..4'), set([1, 2, 3, 4, 5]))
def test_none(self):
self.assertEqual(parse_rank_specification(''), None)
def test_norank(self):
self.assertEqual(parse_rank_specification('1..3,'), set([1, 2, 3, None]))
self.assertEqual(parse_rank_specification(','), set([None]))
if __name__ == '__main__':
import unittest
unittest.main()