Skip to content

Commit

Permalink
fix local tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarriba committed Aug 22, 2018
1 parent f13c462 commit ff88062
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -6,4 +6,7 @@ torchgeometry.egg-info/
*/**/*~
*~
*.swp
.eggs/*
.cache/*
.pytest_cache/*
docs/build
6 changes: 6 additions & 0 deletions README.rst
Expand Up @@ -12,6 +12,12 @@ From source:
python setup.py install
Testing
=======

.. code:: bash
python setup.py test
Contributing
============
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
@@ -0,0 +1,2 @@
[aliases]
test=pytest
4 changes: 4 additions & 0 deletions setup.py
Expand Up @@ -43,6 +43,10 @@ def find_version(*file_paths):
long_description=readme,
license='BSD',

# Test
setup_requires=['pytest-runner'],
tests_require=['pytest'],

# Package info
packages=find_packages(exclude=('test',)),

Expand Down
5 changes: 3 additions & 2 deletions test/test_functional.py
Expand Up @@ -10,15 +10,16 @@ def test_convert_points_to_homogeneous(self):
points = torch.rand(1, 2, 3)

points_h = dgm.convert_points_to_homogeneous(points)
assert (points_h[..., -1] == torch.ones(1, 2, 1)).all()
self.assertTrue((points_h[..., -1] == torch.ones(1, 2, 1)).all())

def test_convert_points_from_homogeneous(self):
points_h = torch.rand(1, 2, 3)
points_h[..., -1] = 1.0

points = dgm.convert_points_from_homogeneous(points_h)
assert (points_h[..., :2] == points[..., :2]).all()

error = torch.sum((points_h[..., :2] - points) ** 2)
self.assertAlmostEqual(error, 0.0)

if __name__ == '__main__':
unittest.main()

0 comments on commit ff88062

Please sign in to comment.