Skip to content

Commit

Permalink
Merge pull request #158 from schwehr/assert-true
Browse files Browse the repository at this point in the history
Use python unittest's checks to get better error messages on failure.
  • Loading branch information
lossyrob authored Aug 18, 2020
2 parents c87f073 + ccc0245 commit 4841bd6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/serialization/test_identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_identify(self):

class VersionTest(unittest.TestCase):
def test_version_ordering(self):
self.assertTrue(STACVersionID('0.9.0') == STACVersionID('0.9.0'))
self.assertEqual(STACVersionID('0.9.0'), STACVersionID('0.9.0'))
self.assertFalse(STACVersionID('0.9.0') < STACVersionID('0.9.0'))
self.assertFalse(STACVersionID('0.9.0') != STACVersionID('0.9.0'))
self.assertFalse(STACVersionID('0.9.0') > STACVersionID('0.9.0'))
Expand Down
4 changes: 2 additions & 2 deletions tests/serialization/test_migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ def test_migrates_renamed_extension(self):
TestCases.get_path('data-files/examples/0.9.0/extensions/asset/'
'examples/example-landsat8.json'))

self.assertTrue('item-assets' in collection.stac_extensions)
self.assertTrue('item_assets' in collection.extra_fields)
self.assertIn('item-assets', collection.stac_extensions)
self.assertIn('item_assets', collection.extra_fields)
4 changes: 2 additions & 2 deletions tests/validation/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_validate_examples(self):
with open(path) as f:
stac_json = json.load(f)

self.assertTrue(len(pystac.validation.validate_dict(stac_json)) == 0)
self.assertEqual(len(pystac.validation.validate_dict(stac_json)), 0)
else:
with self.subTest(path):
with open(path) as f:
Expand All @@ -54,5 +54,5 @@ def test_validate_examples(self):
try:
pystac.validation.validate_dict(stac_json)
except STACValidationError as e:
self.assertTrue(isinstance(e.source, jsonschema.ValidationError))
self.assertIsInstance(e.source, jsonschema.ValidationError)
raise e

0 comments on commit 4841bd6

Please sign in to comment.