Example #1
0
def test_includes_parse_dotted():
    include = ReleaseIncludes({'artists': True, 'mediums': MediumIncludes({})})
    assert_raises(AttributeError, getattr, include, 'does_not_exist')
    assert_true(include.artists)
    assert_true(include.mediums)
    assert_false(include.mediums.tracks)
    assert_false(include.mediums.tracks.artists)
Example #2
0
def test_includes_parse_dotted_deep_params():
    include = ReleaseIncludes.parse([
        'artists',
        'mediums.tracks.(artists,recording.relationships.(artist,work))'
    ])
    assert_true(include.artists)
    assert_true(include.mediums)
    assert_true(include.mediums.tracks)
    assert_true(include.mediums.tracks.artists)
    assert_true(include.mediums.tracks.recording)
    assert_true(include.mediums.tracks.recording.relationships)
    assert_true(include.mediums.tracks.recording.relationships.artist)
    assert_true(include.mediums.tracks.recording.relationships.work)
Example #3
0
def test_includes_parse_dotted_deep():
    include = ReleaseIncludes.parse(['artists', 'mediums.tracks.artists'])
    assert_true(include.artists)
    assert_true(include.mediums)
    assert_true(include.mediums.tracks)
    assert_true(include.mediums.tracks.artists)
Example #4
0
def test_includes_parse_simple_2():
    include = ReleaseIncludes.parse(['artists', 'mediums'])
    assert_true(include.artists)
    assert_true(include.mediums)
    assert_false(include.mediums.tracks)
    assert_false(include.mediums.tracks.artists)
Example #5
0
def test_includes_parse_simple():
    include = ReleaseIncludes.parse(['artists'])
    assert_true(include.artists)
Example #6
0
def test_includes_getters_simple():
    include = ReleaseIncludes({'artists': True})
    assert_raises(AttributeError, getattr, include, 'does_not_exist')
    assert_true(include.artists)
    assert_false(include.mediums)