Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Move response from read to core
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralph Cowling committed Jun 11, 2014
1 parent 7b3220e commit 9508123
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion backdrop/core/data_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .validation import data_set_is_valid
from .nested_merge import nested_merge
from .errors import InvalidSortError
from backdrop.read.response import PeriodGroupedData, PeriodData, \
from backdrop.core.response import PeriodGroupedData, PeriodData, \
GroupedData, SimpleData

import timeutils
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/read/test_grouped_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
from hamcrest import *
from backdrop.read.response import GroupedData
from backdrop.core.response import GroupedData


class TestGroupedData(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/read/test_monthly_grouped_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from nose.tools import *
from hamcrest import *
from backdrop.core.timeseries import MONTH
from backdrop.read.response import PeriodGroupedData
from backdrop.core.response import PeriodGroupedData
from tests.support.test_helpers import d


Expand Down
2 changes: 1 addition & 1 deletion tests/read/test_period_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from hamcrest import *
from nose.tools import *
from backdrop.core.timeseries import WEEK, MONTH
from backdrop.read.response import PeriodData
from backdrop.core.response import PeriodData
from tests.support.test_helpers import d, d_tz


Expand Down
2 changes: 1 addition & 1 deletion tests/read/test_period_grouped_data.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from nose.tools import *
from hamcrest import *
from backdrop.core.timeseries import MONTH
from backdrop.read.response import PeriodGroupedData
from backdrop.core.response import PeriodGroupedData
from tests.support.test_helpers import d


Expand Down
2 changes: 1 addition & 1 deletion tests/read/test_response.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
from hamcrest import *
from backdrop.core.timeseries import MONTH
from backdrop.read.response import create_period_group
from backdrop.core.response import create_period_group
from tests.support.test_helpers import d, d_tz


Expand Down
2 changes: 1 addition & 1 deletion tests/read/test_simple_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
from hamcrest import *
from backdrop.read.response import SimpleData
from backdrop.core.response import SimpleData
from tests.support.test_helpers import d_tz, d


Expand Down
9 changes: 5 additions & 4 deletions tests/read/test_weekly_grouped_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
from nose.tools import *
from hamcrest import *
from backdrop.core.timeseries import WEEK
from backdrop.read.response import PeriodGroupedData
from backdrop.core.response import PeriodGroupedData
from tests.support.test_helpers import d, d_tz


class TestWeeklyGroupedData(unittest.TestCase):

def test_adding_documents(self):
stub_document = {"_subgroup": []}
data = PeriodGroupedData([stub_document], WEEK)
Expand All @@ -20,10 +21,10 @@ def test_returned_data_should_be_immutable(self):

def test_adding_multiple_mongo_documents(self):
stub_document_1 = {
"_subgroup": [ {"_week_start_at": d(2013, 4, 1), "_count": 5} ]
"_subgroup": [{"_week_start_at": d(2013, 4, 1), "_count": 5}]
}
stub_document_2 = {
"_subgroup": [ {"_week_start_at": d(2013, 4, 1), "_count": 5} ]
"_subgroup": [{"_week_start_at": d(2013, 4, 1), "_count": 5}]
}
data = PeriodGroupedData([stub_document_1, stub_document_2], WEEK)
assert_that(data.data(), has_length(2))
Expand All @@ -48,7 +49,7 @@ def test_adding_unrecognized_data_throws_an_error(self):
assert_raises(ValueError, PeriodGroupedData, [stub_document], WEEK)

def test_adding_subgroups_of_unrecognized_format_throws_an_error(self):
stub_document = {"_subgroup": { "foo": "bar" }}
stub_document = {"_subgroup": {"foo": "bar"}}
assert_raises(ValueError, PeriodGroupedData, [stub_document], WEEK)

def test_adding_additional_fields(self):
Expand Down

0 comments on commit 9508123

Please sign in to comment.