コード例 #1
0
ファイル: manager_test.py プロジェクト: Twista/pyassets
def test_adding_and_getting_groups_of_files():
    global static_base_dir
    manager = Manager(static_base_dir)

    js_group = ["js/file1.js", "js/file2.js"]
    manager.add_group("js", js_group)

    js_group = manager.get_by_name("js")
    assert type(js_group), type(FileGroup)
    files = js_group.get_files()
    assert len(files), 2
    for file in js_group:
        print("jsg iter", file)
        assert file in js_group

    for file in js_group.get_files():
        print("jsg iter - get files", file)
        assert file in js_group
コード例 #2
0
ファイル: manager_test.py プロジェクト: Twista/pyassets
def test_processing_files():
    global static_base_dir

    manager = Manager(static_base_dir)

    js_group = ["css/file1.css", "css/file2.css"]
    manager.add_group("js", js_group)

    df = DummyFilter()
    manager.add_filter(df)

    # get output from a manager
    output = manager.output_for_group("js")
    with(open(path.join(static_base_dir, "example_out.css"))) as f:
        # test if content fits
        assert f.read(), output
コード例 #3
0
ファイル: test_coffee_filter.py プロジェクト: Twista/pyassets
def test_cs():
    global here
    expected_out = """(function() {
  var square;

  square = function(x) {
    return x * x;
  };

}).call(this);
    """
    manager = Manager(static_base_dir)

    js_group = ["coffee/test.coffee"]
    manager.add_group("cs", js_group)


    manager.add_filter(CoffeeScriptFilter())

    # get output from a manager
    output = manager.output_for_group("cs")

    assert output, expected_out.strip()