Coverage for tests/test_object_lib.py: 94%
17 statements
« prev ^ index » next coverage.py v7.9.1, created at 2025-06-14 15:55 +0200
« prev ^ index » next coverage.py v7.9.1, created at 2025-06-14 15:55 +0200
1def test_object_lib():
2 import gamdpy as gp
3 import numpy as np
4 ''' Test for the object_lib.py file. object_lib.py contains examples of Configuration and PairPotential classes '''
6 # Test configuration_SC
7 from object_lib import configuration_SC
8 assert isinstance(configuration_SC, gp.Configuration), "Problem with configuration_SC object type"
9 assert np.unique(configuration_SC.ptype)==0, "Problem with configuration_SC.ptypes"
10 assert configuration_SC.N == 1000, "Problem with configuration_SC.N"
11 assert configuration_SC.D == 3, "Problem with configuration_SC.D"
12 assert configuration_SC.compute_flags == {'U': True, 'W': True, 'K': True, 'lapU': False, 'Fsq': False, 'stresses': False, 'Vol': False, 'Ptot': False}, "Problem with configuration_SC.compute_flags"
14 # Test pairpot_LJ
15 from object_lib import pairpot_LJ
16 assert isinstance(pairpot_LJ, gp.PairPotential), "Problem with pairpot_LJ object type"
17 assert pairpot_LJ.params_user == [1.0, 1.0, 2.5], "Problem with pairpot_LJ.params_user"
18 assert pairpot_LJ.exclusions == None, "Problem with pairpot_LJ.exclusions"
19 assert pairpot_LJ.max_num_nbs == 1000, "Problem with pairpot_LJ.max_num_nbs"
21if __name__ == '__main__':
22 test_object_lib()