Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: discogs/discogs_client
base: 28ce74bd6c
...
head fork: discogs/discogs_client
compare: 64d4c9eb2c
  • 3 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
7 discogs_client/models.py
View
@@ -430,6 +430,7 @@ class Artist(PrimaryAPIObject):
profile = SimpleField()
data_quality = SimpleField()
name_variations = SimpleField(key='namevariations')
+ url = SimpleField('uri')
urls = SimpleField()
aliases = ListField('Artist')
members = ListField('Artist')
@@ -458,6 +459,7 @@ class Release(PrimaryAPIObject):
country = SimpleField()
notes = SimpleField()
formats = SimpleField()
+ url = SimpleField('uri')
videos = ListField('Video')
tracklist = ListField('Track')
artists = ListField('Artist')
@@ -488,6 +490,7 @@ class Master(PrimaryAPIObject):
styles = SimpleField()
genres = SimpleField()
images = SimpleField()
+ url = SimpleField('uri')
videos = ListField('Video')
tracklist = ListField('Track')
main_release = ObjectField('Release', as_id=True)
@@ -509,6 +512,7 @@ class Label(PrimaryAPIObject):
images = SimpleField()
contact_info = SimpleField()
data_quality = SimpleField()
+ url = SimpleField('uri')
sublabels = ListField('Label')
parent_label = ObjectField('Label', optional=True)
releases = ObjectCollection('Release')
@@ -530,6 +534,7 @@ class User(PrimaryAPIObject):
num_lists = SimpleField()
rank = SimpleField()
rating_avg = SimpleField()
+ url = SimpleField('uri')
name = SimpleField(writable=True)
profile = SimpleField(writable=True)
location = SimpleField(writable=True)
@@ -611,6 +616,7 @@ class Listing(PrimaryAPIObject):
ships_from = SimpleField()
comments = SimpleField()
audio = SimpleField()
+ url = SimpleField('uri')
price = ObjectField('Price')
release = ObjectField('Release')
seller = ObjectField('User')
@@ -629,6 +635,7 @@ class Order(PrimaryAPIObject):
next_status = SimpleField()
shipping_address = SimpleField()
additional_instructions = SimpleField()
+ url = SimpleField('uri')
status = SimpleField(writable=True)
fee = ObjectField('Price')
buyer = ObjectField('User')
38 discogs_client/tests/test_utils.py
View
@@ -0,0 +1,38 @@
+import unittest
+from datetime import datetime
+from discogs_client.tests import DiscogsClientTestCase
+from discogs_client import utils
+
+class UtilsTestCase(DiscogsClientTestCase):
+ def test_update_qs(self):
+ """update_qs helper works as intended"""
+ u = utils.update_qs
+ self.assertEqual(u('http://example.com', {'foo': 'bar'}), 'http://example.com?foo=bar')
+ self.assertEqual(u('http://example.com?foo=bar', {'foo': 'baz'}), 'http://example.com?foo=bar&foo=baz')
+ self.assertEqual(u('http://example.com?c=3&a=yep', {'a': 1, 'b': '1'}), 'http://example.com?c=3&a=yep&a=1&b=1')
+
+ def test_omit_none(self):
+ o = utils.omit_none
+ self.assertEqual(o({
+ 'foo': None,
+ 'baz': 'bat',
+ 'qux': None,
+ 'flan': 0,
+ }), {
+ 'baz': 'bat',
+ 'flan': 0,
+ })
+
+ self.assertEqual(o(dict((k, None) for k in ('qux', 'quux', 'quuux'))), {})
+ self.assertEqual(o({'nope': 'yep'}), {'nope': 'yep'})
+ self.assertEqual(o({}), {})
+
+ def test_parse_timestamp(self):
+ p = utils.parse_timestamp
+ self.assertEqual(p('2012-01-01T00:00:00'), datetime(2012, 1, 1, 0, 0, 0))
+ self.assertEqual(p('2001-05-25T00:00:42'), datetime(2001, 5, 25, 0, 0, 42))
+
+def suite():
+ suite = unittest.TestSuite()
+ suite = unittest.TestLoader().loadTestsFromTestCase(UtilsTestCase)
+ return suite
1  discogs_client/utils.py
View
@@ -14,4 +14,5 @@ def update_qs(url, params):
def omit_none(dict_):
+ """Removes any key from a dict that has a value of None."""
return dict((k, v) for k, v in dict_.iteritems() if v is not None)

No commit comments for this range

Something went wrong with that request. Please try again.