コード例 #1
0
ファイル: grid_tests.py プロジェクト: ahurka/Arrhenius
    def test_grid_by_count(self):
        """
        Test error-free creation and return of a valid grid, with dimensions
        provided as cell counts.
        """
        grid = GridDimensions((2, 2), "count")

        dims_by_count = grid.dims_by_count()
        dims_by_count_expected = (2, 2)
        self.assertEqual(dims_by_count, dims_by_count_expected)
コード例 #2
0
ファイル: grid_tests.py プロジェクト: ahurka/Arrhenius
    def test_grid_width_to_count(self):
        """
        Test error-free creation and return of a valid grid with dimensions
        provided as cell widths, and the correct conversion of the grid to
        a representation in cell counts.
        """
        grid = GridDimensions((90, 90), "width")

        dims_by_count = grid.dims_by_count()
        dims_by_count_expected = (2, 4)
        self.assertEqual(dims_by_count, dims_by_count_expected)
コード例 #3
0
ファイル: grid_tests.py プロジェクト: ahurka/Arrhenius
    def test_tiny_grid_cells(self):
        """
        Test correct conversion between grid representations when grid cell
        widths are very small.
        """
        grid = GridDimensions((2880, 2880), "count")

        dims_by_width = grid.dims_by_width()
        dims_by_width_expected = (0.0625, 0.125)

        dims_by_count = grid.dims_by_count()
        dims_by_count_expected = (2880, 2880)

        self.assertEqual(dims_by_width, dims_by_width_expected)
        self.assertEqual(dims_by_count, dims_by_count_expected)
コード例 #4
0
ファイル: grid_tests.py プロジェクト: ahurka/Arrhenius
    def test_max_grid_dimensions(self):
        """
        Test that a grid is successfully created when the maximum valid cell
        widths are provided.
        """
        grid = GridDimensions((180, 360), "width")

        dims_by_width = grid.dims_by_width()
        dims_by_width_expected = (180, 360)

        dims_by_count = grid.dims_by_count()
        dims_by_count_expected = (1, 1)

        self.assertEqual(dims_by_width, dims_by_width_expected)
        self.assertEqual(dims_by_count, dims_by_count_expected)
コード例 #5
0
ファイル: grid_tests.py プロジェクト: ahurka/Arrhenius
    def test_float_grid_dims(self):
        """
        Test the error-free creation of a valid grid with floating point
        grid cell widths, and sensible conversion to a representation in
        cell counts.
        """
        grid = GridDimensions((0.5, 1.5), "width")

        dims_by_width = grid.dims_by_width()
        dims_by_width_expected = (0.5, 1.5)

        dims_by_count = grid.dims_by_count()
        dims_by_count_expected = (360, 240)

        self.assertEqual(dims_by_width, dims_by_width_expected)
        self.assertEqual(dims_by_count, dims_by_count_expected)