# pycoast.tests.test_pycoast module

Main unit tests for pycoast.

class pycoast.tests.test_pycoast.FakeAreaDef(proj4_string, area_extent, x_size, y_size)

  Bases: `object`

  A fake area definition object.

class pycoast.tests.test_pycoast.TestContourWriterAGG

  Bases: `_ContourWriterTestBase`

  Test AGG contour writer.

  test_add_cities_agg()
  test_add_cities_cfg_agg()
  test_add_cities_from_dict_agg()
  test_add_grid_from_dict_agg()
  test_add_one_shapefile_from_cfg_agg()
  test_add_points_agg()
  test_add_polygon_agg()
  test_add_shapefile_shapes_agg()
  test_add_shapefiles_from_dict_agg()
  test_coastlines_convert_to_rgba_agg()
  test_config_file_coasts_and_grid()
  test_config_file_points_and_borders_agg()
  test_europe_agg()
  test_europe_agg_file()
  test_geos_agg()
  test_grid_agg()
  test_grid_agg_file()
  test_grid_agg_txt()
  test_grid_geos_agg()
  test_grid_nh_agg()
  test_lonlat_pm_change()

    Test that a longlat projection with a non-0 prime meridian is handled correctly.

class pycoast.tests.test_pycoast.TestContourWriterPIL

  Bases: `object`

  Test PIL-based contour writer.

  test_add_cities_cfg_pil(cw_pil, new_test_image)
  test_add_cities_from_dict_pil(cw_pil, new_test_image)
  test_add_cities_pil(cw_pil, new_test_image)
  test_add_grid_from_dict_pil(cw_pil, new_test_image)
  test_add_one_shapefile_from_cfg_pil(cw_pil, new_test_image)
  test_add_points_bad_coord_ref(cw_pil)
  test_add_points_bad_image_coords(cw_pil)
  test_add_points_coordinate_conversion(cw_pil, new_test_image)

    Check that a point added with lonlat coordinates matches the same point in pixel coordinates.

  test_add_points_pil(cw_pil, new_test_image)
  test_add_polygon(cw_pil, new_test_image)
  test_add_shapefile_shapes(cw_pil, new_test_image)
  test_add_shapefiles_from_dict_pil(cw_pil, new_test_image)
  test_config_file_coasts_and_grid(cw_pil, new_test_image)
  test_config_file_points_and_borders_pil(cw_pil, new_test_image)
  test_europe_coastlines_rivers_and_borders(cw_pil, new_test_image)

    Test coastlines, rivers and borders over Europe.

  test_europe_coastlines_rivers_and_borders_on_file(cw_pil, test_file_path)

    Test coastlines, rivers and borders over Europe on a file.

  test_geos(cw_pil, new_test_image)
  test_grid(cw_pil, new_test_image, filename, shape, area_def, level, grid_kwargs)
  test_grid_file(cw_pil, grid_file_path)
  test_grid_nh(cw_pil, new_test_image)

class pycoast.tests.test_pycoast.TestFromConfig

  Bases: `object`

  Test burning overlays from a config file.

  test_cache_generation_reuse(tmpdir)

    Test generating a transparent foreground and cache it.

  test_cache_nocache_consistency(tmp_path, include_background_pattern, background_mode, upper_right_opacity)

    Test that an image generated with an image looks the same when using a cached foreground.

  test_caching_with_param_changes(tmpdir)

    Testing caching when changing parameters.

  test_foreground()

    Test generating a transparent foreground.

  test_get_resolution(crs_input, extents, size, exp_resolution)

    Get the automagical resolution computation.

pycoast.tests.test_pycoast.bering_straight()

  Create an area covering the Bering straight.

pycoast.tests.test_pycoast.brazil()

  Create a Brazil area.

pycoast.tests.test_pycoast.cd_test_dir(monkeypatch)

  Change directory to the pycoast/tests directory.

pycoast.tests.test_pycoast.cw_agg()

  Create a PIL ContourWriter.

pycoast.tests.test_pycoast.cw_pil()

  Create a PIL ContourWriter.

pycoast.tests.test_pycoast.dateline_1()

  Create an area covering the dateline.

pycoast.tests.test_pycoast.dateline_2()

  Create another area covering the dateline.

pycoast.tests.test_pycoast.eurasia()

  Create a Eurasia area.

pycoast.tests.test_pycoast.europe()

  Create a Europe area.

pycoast.tests.test_pycoast.europe_1024()

  Create a Europe area in 1024 pixels size.

pycoast.tests.test_pycoast.fft_metric(data1, data2, max_value=0.1, plot_failure=False)

  Execute FFT metric.

pycoast.tests.test_pycoast.fft_proj_rms(a1, a2)

  Compute the RMS of differences between FFT vectors of a1 and projection of FFT vectors of a2.

  This metric is sensitive to large scale changes and image noise but insensitive to small rendering differences.

pycoast.tests.test_pycoast.geos()

  Create a geos area.

pycoast.tests.test_pycoast.germ()

  Create an area covering Germany.

pycoast.tests.test_pycoast.grid_file_path(tmp_path)

  Create a test grid image file on disk.

pycoast.tests.test_pycoast.hawaii()

  Create an area covering Hawai.

pycoast.tests.test_pycoast.images_match(ref_image, test_image)

  Check is images match.

pycoast.tests.test_pycoast.lonlat_0(pm=0)

  Create longlat projection over Cuba.

pycoast.tests.test_pycoast.new_test_image(request, tmp_path)

  Create a new test image, and save it to tmp_path if the test fails.

pycoast.tests.test_pycoast.nh()

  Create the nh area.

pycoast.tests.test_pycoast.nh_1024()

  Create the nh area in 1024x1024 pixels.

pycoast.tests.test_pycoast.nh_425()

  Create the nh area in 425 pixels size.

pycoast.tests.test_pycoast.nh_def(shape)

  Create the nh area definition with custom shape.

pycoast.tests.test_pycoast.north_atlantic()

  Create a North Atlantic area.

pycoast.tests.test_pycoast.south_america()

  Create an area covering south America.

pycoast.tests.test_pycoast.test_file_path(tmp_path)

  Create a test image file on disk.

pycoast.tests.test_pycoast.test_no_scratch(new_test_image, cw, filename, shape, area_def, specific_kwargs)

  Test no scratches are visible.

pycoast.tests.test_pycoast.test_shapes(new_test_image, cw, filename, area_def, specific_kwargs)

  Test western/eastern shapes.

pycoast.tests.test_pycoast.uk_and_ireland()

  Create an area covering Ireland and the UK.