# -*- coding: utf-8 -*- """A design summary's strand count is for the design's MAXIMUM width; a narrower (cut-down) piece carries fewer, and that is not a mismatch.""" from vibe import liftexport def test_full_width_piece_expects_the_summary_count(): assert liftexport.strand_count_expectation(19, [], 13.6667, 13.6667) == (19, None) def test_cut_down_piece_takes_the_model_as_it_is_and_says_why(): expected, note = liftexport.strand_count_expectation(19, [], 11.45, 13.6667) assert expected is None assert '19 strands' in note and 'cut-down' in note assert "13' - 8\"" in note or "13'-8\"" in note def test_within_an_inch_of_the_maximum_still_expects_the_count(): assert liftexport.strand_count_expectation(19, [], 13.62, 13.6667) == (19, None) def test_a_layout_counts_the_columns_inside_the_width(): cols = [6, 18, 30, 42, 54, 66, 78, 90, 102, 114, 126, 138, 150, 162] expected, note = liftexport.strand_count_expectation(14, cols, 11.0, 13.6667) assert expected == 11 # columns at or under 132.5 in assert note is None def test_no_qty_means_nothing_expected(): assert liftexport.strand_count_expectation(None, [], 11.0, 13.6667) == (None, None) assert liftexport.strand_count_expectation('x', [], 11.0, 13.6667) == (None, None) def test_no_width_information_falls_back_to_the_summary_count(): assert liftexport.strand_count_expectation(19, [], None, None) == (19, None) assert liftexport.strand_count_expectation(19, [], 11.0, None) == (19, None)