Ejemplo n.º 1
0
def test_bundle_single_entry():
    # we can successfully bundle a single resource (it's not bundled though)
    foo = Library('foo', '')
    a = Resource(foo, 'a.js')

    resources = bundle_resources([a])
    assert resources == [a]
Ejemplo n.º 2
0
def test_bundle_single_entry():
    # we can successfully bundle a single resource (it's not bundled though)
    foo = Library('foo', '')
    a = Resource(foo, 'a.js')

    resources = bundle_resources([a])
    assert resources == [a]
Ejemplo n.º 3
0
def test_bundle():
    foo = Library('foo', '')
    a = Resource(foo, 'a.css')
    b = Resource(foo, 'b.css')

    resources = bundle_resources([a, b])
    assert len(resources) == 1
    bundle = resources[0]
    assert bundle.resources() == [a, b]
Ejemplo n.º 4
0
def test_bundle():
    foo = Library('foo', '')
    a = Resource(foo, 'a.css')
    b = Resource(foo, 'b.css')

    resources = bundle_resources([a, b])
    assert len(resources) == 1
    bundle = resources[0]
    assert bundle.resources() == [a, b]
Ejemplo n.º 5
0
def test_bundle_different_renderer():
    # resources with different renderers aren't bundled
    foo = Library('foo', '')
    a = Resource(foo, 'a.css')
    b = Resource(foo, 'b.js')

    resources = bundle_resources([a, b])
    assert len(resources) == 2
    assert resources[0] is a
    assert resources[1] is b
Ejemplo n.º 6
0
def test_bundle_dont_bundle_at_the_start():
    foo = Library('foo', '')
    a = Resource(foo, 'a.css', dont_bundle=True)
    b = Resource(foo, 'b.css')
    c = Resource(foo, 'c.css')

    resources = bundle_resources([a, b, c])
    assert len(resources) == 2
    assert resources[0] is a
    assert resources[1].resources() == [b, c]
Ejemplo n.º 7
0
def test_bundle_dont_bundle_at_the_end():
    foo = Library('foo', '')
    a = Resource(foo, 'a.css')
    b = Resource(foo, 'b.css')
    c = Resource(foo, 'c.css', dont_bundle=True)

    resources = bundle_resources([a, b, c])
    assert len(resources) == 2
    assert resources[0].resources() == [a, b]
    assert resources[-1] is c
Ejemplo n.º 8
0
def test_bundle_different_renderer():
    # resources with different renderers aren't bundled
    foo = Library('foo', '')
    a = Resource(foo, 'a.css')
    b = Resource(foo, 'b.js')

    resources = bundle_resources([a, b])
    assert len(resources) == 2
    assert resources[0] is a
    assert resources[1] is b
Ejemplo n.º 9
0
def test_bundle_dont_bundle_at_the_start():
    foo = Library('foo', '')
    a = Resource(foo, 'a.css', dont_bundle=True)
    b = Resource(foo, 'b.css')
    c = Resource(foo, 'c.css')

    resources = bundle_resources([a, b, c])
    assert len(resources) == 2
    assert resources[0] is a
    assert resources[1].resources() == [b, c]
Ejemplo n.º 10
0
def test_bundle_dont_bundle_at_the_end():
    foo = Library('foo', '')
    a = Resource(foo, 'a.css')
    b = Resource(foo, 'b.css')
    c = Resource(foo, 'c.css', dont_bundle=True)

    resources = bundle_resources([a, b, c])
    assert len(resources) == 2
    assert resources[0].resources() == [a, b]
    assert resources[-1] is c
Ejemplo n.º 11
0
def test_bundle_different_directory():
    # resources with different directories aren't bundled
    foo = Library('foo', '')
    a = Resource(foo, 'first/a.css')
    b = Resource(foo, 'second/b.css')

    resources = bundle_resources([a, b])
    assert len(resources) == 2
    assert resources[0] is a
    assert resources[1] is b
Ejemplo n.º 12
0
def test_bundle_different_directory():
    # resources with different directories aren't bundled
    foo = Library('foo', '')
    a = Resource(foo, 'first/a.css')
    b = Resource(foo, 'second/b.css')

    resources = bundle_resources([a, b])
    assert len(resources) == 2
    assert resources[0] is a
    assert resources[1] is b
Ejemplo n.º 13
0
def test_bundle_different_library():
    # resources with different libraries aren't bundled
    l1 = Library('l1', '')
    l2 = Library('l2', '')
    a = Resource(l1, 'a.js')
    b = Resource(l2, 'b.js')

    resources = bundle_resources([a, b])
    assert len(resources) == 2
    assert resources[0] is a
    assert resources[1] is b
Ejemplo n.º 14
0
def test_bundle_different_library():
    # resources with different libraries aren't bundled
    l1 = Library('l1', '')
    l2 = Library('l2', '')
    a = Resource(l1, 'a.js')
    b = Resource(l2, 'b.js')

    resources = bundle_resources([a, b])
    assert len(resources) == 2
    assert resources[0] is a
    assert resources[1] is b
Ejemplo n.º 15
0
def test_bundle_dont_bundle_in_the_middle():
    # now construct a scenario where a dont_bundle resource is in the way
    # of bundling
    foo = Library('foo', '')
    a = Resource(foo, 'a.css')
    b = Resource(foo, 'b.css', dont_bundle=True)
    c = Resource(foo, 'c.css')

    resources = bundle_resources([a, b, c])
    assert len(resources) == 3
    assert resources[0] is a
    assert resources[1] is b
    assert resources[2] is c
Ejemplo n.º 16
0
def test_bundle_dont_bundle_in_the_middle():
    # now construct a scenario where a dont_bundle resource is in the way
    # of bundling
    foo = Library('foo', '')
    a = Resource(foo, 'a.css')
    b = Resource(foo, 'b.css', dont_bundle=True)
    c = Resource(foo, 'c.css')

    resources = bundle_resources([a, b, c])
    assert len(resources) == 3
    assert resources[0] is a
    assert resources[1] is b
    assert resources[2] is c
Ejemplo n.º 17
0
def test_bundle_single_dont_bundle_entry():
    foo = Library('foo', '')
    a = Resource(foo, 'a.js', dont_bundle=True)

    resources = bundle_resources([a])
    assert resources == [a]
Ejemplo n.º 18
0
def test_bundle_empty_list():
    # we can successfully bundle an empty list of resources
    resources = bundle_resources([])
    assert resources == []
Ejemplo n.º 19
0
def test_bundle_empty_list():
    # we can successfully bundle an empty list of resources
    resources = bundle_resources([])
    assert resources == []
Ejemplo n.º 20
0
def test_bundle_single_dont_bundle_entry():
    foo = Library('foo', '')
    a = Resource(foo, 'a.js', dont_bundle=True)

    resources = bundle_resources([a])
    assert resources == [a]