Solved my own problem, admitting to my own stupidity for the sake of
posterity and search engines.
The problem was that one of the lines in the test had an extra space
in it before the prompt, (I was using tabs btw, I don't know how it
got there.)
Anyway, that extra space made the whole thing be not recognized. I'm a dork.
On 19/04/07, Ryan Alexander <[EMAIL PROTECTED]> wrote:
> Here's the code at the top of my models.py file:
>
> from django.db import models
> from django.newforms import forms, widgets
> from datetime import datetime
> # Create your models here.
>
> WEEKDAY_CHOICES = (
> (0, 'Monday'),
> (1, 'Tuesday'),
> (2, 'Wednesday'),
> (3, 'Thursday'),
> (4, 'Friday'),
> (5, 'Saturday'),
> (6, 'Sunday')
> )
>
> class DayOfWeek(models.Model):
> """
> A simple class to designate different days of the week.
> this was put in because it was the easiest way to allow
> there to be a many-day-to-one suite model for implementing
> the ability to run suites on specific days.
>
> The numbers of the days are based out of WEEKDAY_CHOICES who's numbers
> are determined by the values returned by the datetime modules
> WEEKDAY function.
>
> # create some days
> >>> mon = DayOfWeek.objects.create(day=0)
> >>> tue = DayOfWeek.objects.create(day=1)
> >>> wed = DayOfWeek.objects.create(day=2)
> >>> thu = DayOfWeek.objects.create(day=3)
> >>> fri = DayOfWeek.objects.create(day=4)
> >>> sat = DayOfWeek.objects.create(day=5)
> >>> sun = DayOfWeek.objects.create(day=6)
>
> # check that they return the right values
> >>> mon
> <DayOfWeek: Monday>
> >>> print mon
> Monday
> >>> print mon.day
> 0
> >>> tue
> <DayOfWeek: Tuesday>
> >>> print tue
> Tuesday
> >>> print tue.day
> 1
IT WAS THIS LINE!! Gaaah.
> >>> wed
> <DayOfWeek: Wednesday>
> >>> print wed
> Wednesday
> >>> print wed.day
> 2
> >>> thu
> <DayOfWeek: Thursday>
> >>> print thu
> Thursday
> >>> print thu.day
> 3
> >>> fri
> <DayOfWeek: Friday>
> >>> print fri
> Friday
> >>> print fri.day
> 4
> >>> sat
> <DayOfWeek: Saturday>
> >>> print sat
> Saturday
> >>> print sat.day
> 5
> >>> sun
> <DayOfWeek: Sunday>
> >>> print sun
> Sunday
> >>> print sun.day
> 6
> """
> day = models.PositiveSmallIntegerField('Day',choices=WEEKDAY_CHOICES)
>
> def __str__(self):
> if self.day is None:
> return 'undefined'
> else:
> return WEEKDAY_CHOICES[int(self.day)][1]
>
> class Meta:
> ordering = ("day",)
>
>
>
>
> yet when I do the:
>
> python manage.py test
>
> command, it says Ran 0 tests in 0.000s
>
> Is there something I didn't set up properly? I followed the
> instructions on the django site?!
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---