def test_calendar_year(self): """ Tests that "Calendar Year 2005" gets turned into "2005" in weave. """ from indicators.models import Indicator, IndicatorData from weave.load import run from weave.models import AttributeColumn i = Indicator.objects.create( name='test', display_name='test' ) IndicatorData.objects.create(indicator=i, time_type='Calendar Year', time_key = "2005", key_unit_type = "School", key_value = "00001", data_type = 'numeric', numeric = 100) run() self.failUnlessEqual(AttributeColumn.objects.all().count(), 1) self.failUnlessEqual(AttributeColumn.objects.all()[0].year, '2005')
def test_blank_time_type(self): """ Tests that blank time types can pass through type conversion. """ from indicators.models import Indicator, IndicatorData from weave.load import run from weave.models import AttributeColumn i = Indicator.objects.create( name='test', display_name='test' ) IndicatorData.objects.create(indicator=i, time_type=None, time_key = None, key_unit_type = "School", key_value = "00001", data_type = 'numeric', numeric = 100) run() self.failUnlessEqual(AttributeColumn.objects.all().count(), 1) self.failUnlessEqual(AttributeColumn.objects.all()[0].year, '')
def handle(self, *args, **options): from weave.load import run run()