Example #1
0
def test_advanced_uncrunch():
    assert uncrunch("50:0-1,3-4;3:2,5;60:6;70:7-8") == [
        "50",
        "50",
        "3",
        "50",
        "50",
        "3",
        "60",
        "70",
        "70",
    ]
Example #2
0
    def page_aspect_ratio(self, page):
        """Return the aspect ratio for a given page"""
        default = 0.77
        if not self.page_spec:
            return default

        try:
            dimensions = uncrunch(self.page_spec)[page]
        except (ValueError, KeyError):
            return default

        width, height = [float(d) for d in dimensions.split("x")]

        return width / height
Example #3
0
def test_basic_uncrunch():
    assert uncrunch("1:0;2:1;3:2") == ["1", "2", "3"]
Example #4
0
def test_single_item_uncrunch():
    assert uncrunch("77:0") == ["77"]
Example #5
0
def test_empty_uncrunch():
    assert uncrunch("") == []
Example #6
0
def test_order_uncrunch():
    assert uncrunch("2:0;1:1") == ["2", "1"]
Example #7
0
def test_basic_broken_run_uncrunch():
    assert uncrunch("1:0,2;2:1") == ["1", "2", "1"]
Example #8
0
def test_basic_run_uncrunch():
    assert uncrunch("1:0-2") == ["1", "1", "1"]