Skip to content

Commit

Permalink
Added tests gee-community#567
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Jul 10, 2021
1 parent 8b6824f commit c8e7678
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 192 deletions.
105 changes: 0 additions & 105 deletions .github/workflows/integration.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/ok-to-test.yml

This file was deleted.

96 changes: 43 additions & 53 deletions tests/test_geemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,61 +20,51 @@ def setUp(self):
def tearDown(self):
"""Tear down test fixtures, if any."""

# def test_001_default_settings(self):
# """Test the default settings returns an ImageCollection"""
# sentCollection = sentinel2_timeseries()
# self.assertIsInstance(sentCollection, ee.imagecollection.ImageCollection)
def test_001_default_settings(self):
"""Test the default settings returns an ImageCollection"""
sentCollection = sentinel2_timeseries()
self.assertIsInstance(sentCollection, ee.imagecollection.ImageCollection)

# def test_002_good_years(self):
# start_year = [*range(2015, 2020, 1)]
# end_year = 2020
# for year in start_year:
# sentCollection = sentinel2_timeseries(start_year=year, end_year=end_year)
# self.assertIsInstance(sentCollection, ee.imagecollection.ImageCollection)
def test_002_good_years(self):
start_year = [*range(2015, 2020, 1)]
end_year = 2020
for year in start_year:
sentCollection = sentinel2_timeseries(start_year=year, end_year=end_year)
self.assertIsInstance(sentCollection, ee.imagecollection.ImageCollection)

# def test_003_good_dates(self):
# start_date = "06-01"
# end_date = "12-01"
# sentCollection = sentinel2_timeseries(start_date=start_date, end_date=end_date)
# self.assertIsInstance(sentCollection, ee.imagecollection.ImageCollection)
def test_003_good_dates(self):
start_date = "06-01"
end_date = "12-01"
sentCollection = sentinel2_timeseries(start_date=start_date, end_date=end_date)
self.assertIsInstance(sentCollection, ee.imagecollection.ImageCollection)

# def test_004_bad_years(self):
# years = [[2014, 2020], [2015, 2021], [205, 2019], [2016, 202]]
# for start_year, end_year in years:
# sentCollection = sentinel2_timeseries(
# start_year=start_year, end_year=end_year
# )
# self.assertNotIsInstance(sentCollection, ee.imagecollection.ImageCollection)
def test_004_bad_years(self):
years = [[2014, 2020], [2015, 2021], [205, 2019], [2016, 202]]
for start_year, end_year in years:
sentCollection = sentinel2_timeseries(
start_year=start_year, end_year=end_year
)
self.assertNotIsInstance(sentCollection, ee.imagecollection.ImageCollection)

# def test_006_prior_years(self):
# years = [
# [2016, 2015],
# [2017, 2015],
# [2018, 2015],
# [2019, 2015],
# [2018, 2016],
# [2019, 2017],
# ]
# for start_year, end_year in years:
# self.assertRaises(
# Exception,
# sentinel2_timeseries(start_year=start_year, end_year=end_year),
# )
def test_006_prior_years(self):
years = [
[2016, 2015],
[2017, 2015],
[2018, 2015],
[2019, 2015],
[2018, 2016],
[2019, 2017],
]
for start_year, end_year in years:
self.assertRaises(
Exception,
sentinel2_timeseries(start_year=start_year, end_year=end_year),
)

# def test_007_bad_dates(self):
# start_date = "06-01"
# end_date = "31-12"
# self.assertRaises(
# Exception,
# sentinel2_timeseries(start_date=start_date, end_date=end_date),
# )

# def test_command_line_interface(self):
# """Test the CLI."""
# runner = CliRunner()
# result = runner.invoke(cli.main)
# assert result.exit_code == 0
# assert 'geemap.cli.main' in result.output
# help_result = runner.invoke(cli.main, ['--help'])
# assert help_result.exit_code == 0
# assert '--help Show this message and exit.' in help_result.output
def test_007_bad_dates(self):
start_date = "06-01"
end_date = "31-12"
self.assertRaises(
Exception,
sentinel2_timeseries(start_date=start_date, end_date=end_date),
)

0 comments on commit c8e7678

Please sign in to comment.