Skip to content

Commit 6752600

Browse files
committed
Improve BEAM related tests
1 parent 0efd5fb commit 6752600

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

test/test_madx.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,12 @@ def test_verbose(mad):
342342

343343

344344
def test_current_beam(mad):
345-
mad.beam(particle='electron', ex=1, ey=2)
345+
# Check that .beam provides access to the default BEAM:
346+
mad.input("beam, particle='electron', ex=1, ey=2;")
346347
assert mad.beam.particle == 'electron'
347348
assert mad.beam.ex == 1
348349
assert mad.beam.ey == 2
350+
# Check that .beam can be used as command:
349351
mad.beam(particle='positron', ex=2, ey=1)
350352
assert mad.beam.particle == 'positron'
351353
assert mad.beam.ex == 2
@@ -1034,7 +1036,7 @@ def test_dframe_after_use(mad):
10341036
['#s', '#e', 'dfd', 'mqd', 'dff', 'mqf']
10351037

10361038

1037-
def test_beam_list(mad, lib):
1038-
mad.beam(pc=100)
1039-
assert lib.get_beam('default_beam')['data']['pc'].value == 100
1040-
assert lib.get_beam_names() == ['default_beam']
1039+
def test_beams(mad):
1040+
mad.input("beam, pc=100;")
1041+
assert mad.beams.default_beam.pc == 100
1042+
assert list(mad.beams) == ['default_beam']

0 commit comments

Comments
 (0)