better torrent tests, add getMovieId test

This commit is contained in:
j 2008-05-08 12:43:35 +02:00
parent b9634887ff
commit 416ceb1ef9
3 changed files with 9 additions and 6 deletions

View file

@ -19,6 +19,10 @@ from oxutils.normalize import normalizeTitle, normalizeImdbId
import google import google
def getMovieId(title, director='', year=''): def getMovieId(title, director='', year=''):
'''
>>> getMovieId('The Matrix')
'0133093'
'''
if year: if year:
title = "%s (%s)" % (title, year) title = "%s (%s)" % (title, year)
if director: if director:

View file

@ -6,7 +6,6 @@ from datetime import datetime
import re import re
import socket import socket
from urllib import quote from urllib import quote
import sha
from oxutils.cache import getUrl, getUrlUnicode from oxutils.cache import getUrl, getUrlUnicode
from oxutils import findRe, cache, stripTags, decodeHtml, getTorrentInfo, intValue, normalizeNewlines from oxutils import findRe, cache, stripTags, decodeHtml, getTorrentInfo, intValue, normalizeNewlines
@ -91,8 +90,8 @@ class Mininova(Torrent):
''' '''
>>> Mininova('123') >>> Mininova('123')
{} {}
>>> sha.sha(unicode(Mininova('1072195'))).hexdigest() >>> Mininova('1072195')['infohash']
'ec98268a0aeaef8292f7bcf3585d0bc3910b3fac' '72dfa59d2338e4a48c78cec9de25964cddb64104'
''' '''
def __init__(self, mininovaId): def __init__(self, mininovaId):
self.data = getData(mininovaId) self.data = getData(mininovaId)

View file

@ -7,7 +7,7 @@ import re
import socket import socket
from urllib import quote, urlencode from urllib import quote, urlencode
from urllib2 import URLError from urllib2 import URLError
import sha
from oxutils.cache import getUrl, getUrlUnicode from oxutils.cache import getUrl, getUrlUnicode
from oxutils import findRe, cache, stripTags, decodeHtml, getTorrentInfo, normalizeNewlines from oxutils import findRe, cache, stripTags, decodeHtml, getTorrentInfo, normalizeNewlines
@ -104,8 +104,8 @@ class Thepiratebay(Torrent):
>>> Thepiratebay('123') >>> Thepiratebay('123')
{} {}
>>> sha.sha(unicode(Thepiratebay('3951349'))).hexdigest() >>> Thepiratebay('3951349')['infohash']
'ef64e438e3eef6e6a05cac4eea56b9f0289d3f22' '4e84415d36ed7b54066160c05a0b0f061898d12b'
''' '''
def __init__(self, piratebayId): def __init__(self, piratebayId):
self.data = getData(piratebayId) self.data = getData(piratebayId)