diff options
author | Mike Crute <mcrute@gmail.com> | 2010-02-04 20:58:45 -0500 |
---|---|---|
committer | Mike Crute <mcrute@gmail.com> | 2010-02-04 20:58:45 -0500 |
commit | 331d9da27b66ad0d2f0ddb88020d853af51d3ada (patch) | |
tree | f07b543136dc4e00ecf22cc65876b4098903e82f | |
parent | 81f199686214a0d5f64a2c14019c543906279928 (diff) | |
download | kronos-331d9da27b66ad0d2f0ddb88020d853af51d3ada.tar.bz2 kronos-331d9da27b66ad0d2f0ddb88020d853af51d3ada.tar.xz kronos-331d9da27b66ad0d2f0ddb88020d853af51d3ada.zip |
Stubbing out tests.
-rw-r--r-- | .hgignore | 2 | ||||
-rw-r--r-- | kronos/parser.py | 20 | ||||
-rw-r--r-- | kronos/tests/test_parser.py | 69 |
3 files changed, 91 insertions, 0 deletions
diff --git a/.hgignore b/.hgignore new file mode 100644 index 0000000..2c9154d --- /dev/null +++ b/.hgignore | |||
@@ -0,0 +1,2 @@ | |||
1 | syntax: glob | ||
2 | *.pyc | ||
diff --git a/kronos/parser.py b/kronos/parser.py new file mode 100644 index 0000000..5f79144 --- /dev/null +++ b/kronos/parser.py | |||
@@ -0,0 +1,20 @@ | |||
1 | # vim: set filencoding=utf8 | ||
2 | """ | ||
3 | Activity Parser | ||
4 | |||
5 | @author: Mike Crute (mcrute@ag.com) | ||
6 | @organization: American Greetings Interactive | ||
7 | @date: February 04, 2010 | ||
8 | """ | ||
9 | |||
10 | class Activity(object): | ||
11 | |||
12 | activity = "my activity" | ||
13 | description = "Some cool stuff!" | ||
14 | category = "Home" | ||
15 | |||
16 | |||
17 | class ActivityParser(object): | ||
18 | |||
19 | def parse(self, text): | ||
20 | return Activity() | ||
diff --git a/kronos/tests/test_parser.py b/kronos/tests/test_parser.py new file mode 100644 index 0000000..676a471 --- /dev/null +++ b/kronos/tests/test_parser.py | |||
@@ -0,0 +1,69 @@ | |||
1 | # vim: set filencoding=utf8 | ||
2 | """ | ||
3 | Activity Parser Test Suite | ||
4 | |||
5 | @author: Mike Crute (mcrute@ag.com) | ||
6 | @organization: American Greetings Interactive | ||
7 | @date: February 04, 2010 | ||
8 | """ | ||
9 | |||
10 | |||
11 | from nose.tools import assert_equals | ||
12 | from kronos.parser import ActivityParser | ||
13 | |||
14 | |||
15 | class TestWhenParsingBasicFormat(object): | ||
16 | |||
17 | def setup(self): | ||
18 | test_input = "my activity, Some cool stuff!@Home" | ||
19 | self.results = ActivityParser().parse(test_input) | ||
20 | |||
21 | def test_should_get_activity(self): | ||
22 | assert_equals(self.results.activity, "my activity") | ||
23 | |||
24 | def test_should_get_description(self): | ||
25 | assert_equals(self.results.description, "Some cool stuff!") | ||
26 | |||
27 | def test_should_get_category(self): | ||
28 | assert_equals(self.results.category, "Home") | ||
29 | |||
30 | |||
31 | class TestWhenParsingWithTags(object): | ||
32 | |||
33 | def setup(self): | ||
34 | test_input = "my activity, Some cool stuff!@Home #tag1 #tag2" | ||
35 | self.results = ActivityParser().parse(test_input) | ||
36 | |||
37 | def test_should_get_tags(self): | ||
38 | pass | ||
39 | |||
40 | |||
41 | class TestWhenParsingWithTimeOffset(object): | ||
42 | |||
43 | def _parse_text(self, text): | ||
44 | return ActivityParser().parse(text) | ||
45 | |||
46 | def test_should_understand_minutes(self): | ||
47 | test_input = "my activity, Some cool stuff!@Home 10m" | ||
48 | test_input = "my activity, Some cool stuff!@Home 10M" | ||
49 | |||
50 | def test_should_understand_hours(self): | ||
51 | test_input = "my activity, Some cool stuff!@Home 10h" | ||
52 | test_input = "my activity, Some cool stuff!@Home 10H" | ||
53 | |||
54 | def test_should_understand_seconds(self): | ||
55 | test_input = "my activity, Some cool stuff!@Home 10s" | ||
56 | test_input = "my activity, Some cool stuff!@Home 10S" | ||
57 | |||
58 | |||
59 | class TestWhenParsingWithAbsoluteTime(object): | ||
60 | |||
61 | def _parse_text(self, text): | ||
62 | return ActivityParser().parse(text) | ||
63 | |||
64 | def test_should_understand_military_time(self): | ||
65 | test_input = "my activity, Some cool stuff!@Home 11:30-14:40" | ||
66 | |||
67 | def test_should_understand_simple_time(self): | ||
68 | test_input = "my activity, Some cool stuff!@Home 11:30AM-2:40PM" | ||
69 | test_input = "my activity, Some cool stuff!@Home 11:30A-2:40P" | ||