Skip to content

Commit 7031b3d

Browse files
committed
Marbles test
1 parent dfe6204 commit 7031b3d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

7_marbles_test.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import marbles.core
2+
from marbles.mixins import mixins
3+
4+
import pandas as pd
5+
import numpy as np
6+
from datetime import datetime, timedelta
7+
8+
class AgeTestCase(marbles.core.TestCase,mixins.DateTimeMixins):
9+
def setUp(self):
10+
self.df = pd.DataFrame({'parent':[datetime(1959,7,12)],
11+
'child':[datetime(1800,1,1)]},
12+
index=[0])
13+
14+
def tearDown(self):
15+
self.df = None
16+
17+
def test_parent_older_child(self):
18+
self.assertDateTimesBefore(sequence=self.df.parent,
19+
target=self.df.child,
20+
note='Parents have to be born after their children')
21+
22+
def test_old_age(self):
23+
max_td = timedelta(365*100)
24+
today = datetime.today()
25+
26+
self.assertDateTimesAfter(sequence=self.df.child,target=today-max_td)
27+
28+
if __name__ == '__main__':
29+
marbles.core.main()

0 commit comments

Comments
 (0)