def test_get_s_pos_returns_all_points_for_lattice_with_two_elements_and_refpts_None( ): e = elements.Element('e', 0.1) f = elements.Element('e', 2.1) print(lattice.get_s_pos([e, f], None)) numpy.testing.assert_equal(lattice.get_s_pos([e, f], None), numpy.array([0, 0.1, 2.2]))
def test_get_s_pos_returns_all_points_for_lattice_with_two_elements_using_int_refpts( ): e = elements.Element('e', 0.1) f = elements.Element('e', 2.1) lat = [e, f] numpy.testing.assert_equal(lattice.get_s_pos(lat, range(len(lat) + 1)), numpy.array([0, 0.1, 2.2]))
def test_element_creation_raises_exception(): with pytest.raises(ValueError): elements.Element('family_name', R1='not_an_array')
def test_base_element_methods(): e = elements.Element('family_name') assert e.divide([0.2, 0.5, 0.3]) == [e] assert id(e.copy()) != id(e)
def test_get_s_pos_returns_length_for_lattice_with_one_element(): e = elements.Element('e', 0.1) assert lattice.get_s_pos([e], [1]) == numpy.array([0.1])