-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: input files in calculation module (#159)
* Expose input files via py4vasp.calculation * Add test for calculation module
- Loading branch information
1 parent
3029c4a
commit f227110
Showing
4 changed files
with
41 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright © VASP Software GmbH, | ||
# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
import pytest | ||
|
||
from py4vasp import Calculation, calculation, exception | ||
|
||
|
||
def test_access_of_attributes(): | ||
calc = Calculation.from_path(".") | ||
for key in filter(attribute_included, dir(calc)): | ||
getattr(calculation, key) | ||
|
||
|
||
def attribute_included(attr): | ||
if attr.startswith("_"): # do not include private attributes | ||
return False | ||
if attr.startswith("from"): # do not include classmethods | ||
return False | ||
return True | ||
|
||
|
||
def test_nonexisting_attribute(): | ||
with pytest.raises(exception.MissingAttribute): | ||
calculation.does_not_exist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters