Re: Unittests

2009-04-17 Thread Daniel Joshua Worth
>
> No - please don't. The Django docs explicitly state that Django's test
> framework is based on Python's unittest and doctest frameworks, and
> provides links to the docs for those frameworks. It's not our place to
> including "how to use unittest" or "how to use doctest" documentation,
> as we would be reproducing the documentation provided by Python. If
> you feel that Python's docs don't make the prefix behaviour
> sufficiently explicit, then this needs to be taken up with the Python
> documentation team, not us.
>

There is a helper box that explains what a doc string is. I don't think a
few added words about naming convention would be overboard. I'm not married
to the idea that all documentation needs to be exhaustingly detailed but a
few words that mention it would have been nice. That being said I'm happy to
file a report or not and I'm certainly not looking to start a flame war over
it.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Unittests

2009-04-17 Thread Daniel Joshua Worth
Of course that worked. I would like to put a plug in for adding that the
tests need to begging with test in the docs. Would have saved me some
trouble. Thank you guys so much for your help.

Daniel Worth

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Unittests

2009-04-17 Thread Daniel Joshua Worth
If I run "./manage.py tests booking" it returns ok but says it ran 0 tests
so I'm obviously not doing something right if it's not running the test at
all. I keep reading the docs but it's not coming to me what I messed up.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Unittests

2009-04-16 Thread Daniel Joshua Worth
the method past_performance() simply checks if the date of the performance
is before today's date.

>>> Can you send your test.py file to the list?

import unittest
from booking.models import *

class PerformanceTest(unittest.TestCase):
def setUp(self):
self.performance = Performance.objects.create(title='test',
venue='test venue',
date='2009-01-01', street1='1234 test way', street2='unit #1',
city='testville',
state='CO', zip='0', price='$10', link='
http://example.com',
contact='exam...@example.com', phone='111-111-',
note='testing one two three',public=1)

def pastTest(self):
self.assertEquals(self.performance.past_performance(), False)

>>> You should rather not name it "test.py" because there is a standard
>>>Python module with that name.

The file is named tests.py, plural(I miss typed). I am just trying to follow
the docs on unittests.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Unittests

2009-04-15 Thread Daniel Joshua Worth
I'm trying to learn unit test and have a unit test for a model in test.py
and have a test set up to fail.
When I run manage.py test it returns that all tests are OK.
If I run manage.py test  it returns OK.
If I run manage.py test . it returns OK.
If I run manage.py test .. if Fails.
What gives. Am I missing something as far as unittests are concerned? It
should Fail every time or it's not much of a test.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Help Figuring Out Relationships

2009-04-09 Thread Daniel Joshua Worth
On Wed, Apr 8, 2009 at 8:25 PM, Malcolm Tredinnick  wrote:

>
> On Wed, 2009-04-08 at 10:37 -0700, PipeManMusic wrote:
> > I'm working on a project that handles Discography's and I am having
> > trouble figuring out the relationships.
> >
> > Artist: Can belong to more than one Group play more than one Instument/
> > Production Role on more than one Album and could vary based on the
> > Song
> >
> > Song: Can be on more than one Album, be played by more than one Group,
> > can have multiple Artist with varying Instrument/Production Roles.
> >
> > Instrument/Production Role: Seems pretty straight ahead. producer,
> > guitar ect.
> >
> > Album: can have more than one Group, Artist, Songs.
> >
> > Group: can have more than one Artist with different Intruments/
> > Production Roles, play multiple Songs on multiple Albums.
>
> This is a nice, clear description of what you want, so it turns out not
> to be too hard to model. I find it easiest in these situation to work
> out what the big "collection" objects are. Modelling often comes down to
> various things being grouped together into larger and larger
> collections.
>
> Here, an album is the ultimate collection. It contains songs. However, a
> "song" is really a particular song (identified by, say, title and
> composer) and a group performing it. So we can think of an album as a
> collection of performances. A performance links a group and a song and
> the artists involved in the performance. The link between artists and
> performances is annotate by the instrument they are playing. I'm
> simplifying a little and saying each link contains only a single
> instrument. If somebody is playing two instruments in the same
> performane, I'll just include them twice, with a different instrument
> each time.
>
> For me, thinking about things as collections helps me work out which
> direction many-to-one relations go and which relations are many-to-many
> The collectors objects and the "one" end of a many-to-one.
>
> This leads to something like the following.
>
>class Group(Model):
>   ...
>
>class Song(Model):
>   title = CharField(...)
>   composer = CharField(...)
>   author = CharField(...)
>   ...
>
>class Artist(Model):
>   performance = ManyToManyField("Performance",
> through="ArtistPerformance")
>   ...
>
>class Performance(Model):
>   group = ForeignKey(Group)
>   song = ForeignKey(Song)
>
>class ArtistPerformance(Model):
>   artist = ForeignKey(Artist)
>   performance = ForeignKey(Performance)
>   instrument = CharField(...)
>
>class Album(Model):
>   tracks = ManyToManyField(Performance)
>
> I think that gives you what you're after. Probably the only slightly
> tricky part here -- at least, the part that took me a couple of stabs to
> get right -- was creating the Performance model to track the links
> between song, group and the artists performing on that song. After that,
> it was just "collection chasing".
>
> Regards,
> Malcolm
>

Thank you so much. I'll have to take some more time figuring how you  made
the connections but this was very helpful. I think I was trying to approach
it backwards. The idea of artists performances is brilliant.

Thanks
Daniel Worth

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---