Skip to content

Commit 882fa52

Browse files
committed
Move tests for utils module
1 parent 6222c66 commit 882fa52

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
from github3.utils import timestamp_parameter
2-
from tests.utils import BaseCase
31
from datetime import datetime
2+
from github3.utils import timestamp_parameter
43

4+
import pytest
55

6-
class TestTimestampParameter(BaseCase):
76

7+
class TestTimestampConverter:
88
def test_datetimes(self):
99
timestamp = datetime(2010, 6, 1, 12, 15, 30)
10-
self.assertEqual('2010-06-01T12:15:30', timestamp_parameter(timestamp))
10+
assert '2010-06-01T12:15:30' == timestamp_parameter(timestamp)
1111

1212
def test_valid_datestring(self):
1313
testvals = (
@@ -18,7 +18,7 @@ def test_valid_datestring(self):
1818
'2010-06-01T12:14:30.2115Z',
1919
)
2020
for timestamp in testvals:
21-
self.assertEqual(timestamp, timestamp_parameter(timestamp))
21+
assert timestamp == timestamp_parameter(timestamp)
2222

2323
def test_invalid_datestring(self):
2424
testvals = (
@@ -29,12 +29,12 @@ def test_invalid_datestring(self):
2929
'2010-06-01T12:70:30.12321+02',
3030
)
3131
for timestamp in testvals:
32-
self.assertRaises(ValueError, timestamp_parameter, timestamp)
32+
pytest.raises(ValueError, timestamp_parameter, timestamp)
3333

3434
def test_none_handling(self):
35-
self.assertTrue(timestamp_parameter(None, allow_none=True) is None)
36-
self.assertRaises(ValueError, timestamp_parameter, None,
37-
allow_none=False)
35+
assert timestamp_parameter(None, allow_none=True) is None
36+
pytest.raises(ValueError, timestamp_parameter, None,
37+
allow_none=False)
3838

3939
def test_invalid_type_handling(self):
40-
self.assertRaises(ValueError, timestamp_parameter, 1)
40+
pytest.raises(ValueError, timestamp_parameter, 1)

0 commit comments

Comments
 (0)