MCPcopy Create free account
hub / github.com/SINGROUP/dscribe / assert_cell

Function assert_cell

tests/conftest.py:385–401  ·  view source on GitHub ↗

Test that different types of cells are handled correctly.

(descriptor_func, cell)

Source from the content-addressed store, hash-verified

383
384
385def assert_cell(descriptor_func, cell):
386 """Test that different types of cells are handled correctly."""
387 system = get_simple_finite()
388 # Error is raised if there is no cell when periodicity=True
389 if cell == "collapsed_periodic":
390 system.set_pbc(True)
391 system.set_cell([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]])
392 desc = descriptor_func(periodic=True)([system])
393 with pytest.raises(ValueError):
394 desc.create(system)
395 # No error is raised if there is no cell when periodicity=False
396 elif cell == "collapsed_finite":
397 system.set_cell([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]])
398 desc = descriptor_func(periodic=False)([system])
399 desc.create(system)
400 else:
401 raise ValueError("Unknown cell option")
402
403
404def assert_systems(descriptor_func, pbc, cell):

Callers 2

test_cellFunction · 0.90
test_cellFunction · 0.90

Calls 4

get_simple_finiteFunction · 0.85
set_pbcMethod · 0.80
set_cellMethod · 0.80
createMethod · 0.45

Tested by

no test coverage detected