Skip to content

Commit

Permalink
maint: codacy warning updates
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Papior <[email protected]>
  • Loading branch information
zerothi committed Oct 5, 2017
1 parent ed2f3b4 commit 4168bce
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 40 deletions.
6 changes: 3 additions & 3 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ignore:
- "benchmarks"
- "data"
- **/tests
- benchmarks
- data
- **/tests/test_*.py

coverage:
notify:
Expand Down
25 changes: 25 additions & 0 deletions sisl/unit/tests/test_unit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from __future__ import print_function, division

import pytest

from sisl.unit import unit_group, unit_convert, unit_default

pytestmark = pytest.mark.unit


def test_group():
assert unit_group('kg') == 'mass'
assert unit_group('eV') == 'energy'
assert unit_group('N') == 'force'


def test_unit_convert():
assert pytest.approx(unit_convert('kg', 'g')) == 1.e3
assert pytest.approx(unit_convert('eV', 'J')) == 1.60217733e-19
assert pytest.approx(unit_convert('J', 'eV')) == 1/1.60217733e-19


def test_default():
assert unit_default('mass') == 'amu'
assert unit_default('energy') == 'eV'
assert unit_default('force') == 'eV/Ang'
30 changes: 16 additions & 14 deletions sisl/unit/tests/test_unit_siesta.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@

import pytest

from sisl.unit.siesta import *
from sisl.unit.siesta import unit_group, unit_convert, unit_default

pytestmark = pytest.mark.unit

class TestUnits(object):

def test_group(self):
assert unit_group('kg') == 'mass'
assert unit_group('eV') == 'energy'
assert unit_group('N') == 'force'
def test_group():
assert unit_group('kg') == 'mass'
assert unit_group('eV') == 'energy'
assert unit_group('N') == 'force'

def test_unit_convert(self):
assert pytest.approx(unit_convert('kg', 'g')) == 1.e3
assert pytest.approx(unit_convert('eV', 'J')) == 1.60219e-19
assert pytest.approx(unit_convert('J', 'eV')) == 1/1.60219e-19

def test_default(self):
assert unit_default('mass') == 'amu'
assert unit_default('energy') == 'Ry'
assert unit_default('force') == 'Ry/Bohr'
def test_unit_convert():
assert pytest.approx(unit_convert('kg', 'g')) == 1.e3
assert pytest.approx(unit_convert('eV', 'J')) == 1.60219e-19
assert pytest.approx(unit_convert('J', 'eV')) == 1/1.60219e-19


def test_default():
assert unit_default('mass') == 'amu'
assert unit_default('energy') == 'Ry'
assert unit_default('force') == 'Ry/Bohr'
23 changes: 0 additions & 23 deletions sisl/unit/tests/test_units.py

This file was deleted.

0 comments on commit 4168bce

Please sign in to comment.