Skip to content
This repository has been archived by the owner on Dec 27, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:brettviren/gegede
Browse files Browse the repository at this point in the history
  • Loading branch information
brettviren committed Nov 6, 2015
2 parents ecf78e3 + 6ddfeb2 commit 842e2ee
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/test_configuration.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ height = 10*width
depth = height*1.23
dims = [width, height, depth]
offset = [Q("1m"), Q("2m"), Q("3m")]
integer = 42
floating = 6.9
string = "hello world"
sequence = [1,2,3]

[sb1]
class = gegede.examples.builders.SimpleBuilder
subbuilders = ["ssb1", "ssb2"]
## doesn't work now because interpolation is global and before any eval()
#height = {mybuilder:height}


[sb2]
class = gegede.examples.builders.SimpleBuilder
Expand Down
16 changes: 16 additions & 0 deletions tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import gegede.configuration as ggdconf
from gegede import Quantity as Q

def test_read():
fname = os.path.splitext(__file__)[0]+'.cfg'
Expand All @@ -16,6 +17,21 @@ def test_configure():
cfg = ggdconf.configure(fname)
worldname, worldcfg = cfg.items()[0]
assert 2 == len(worldcfg['subbuilders'])
assert worldcfg['width'] == Q(10,'meter')
want_height = Q(100,'meter')
assert worldcfg['height'] == want_height
assert worldcfg['depth'] == Q(123,'meter')

assert type(worldcfg['integer']) == int
assert type(worldcfg['floating']) == float
assert type(worldcfg['string']) == str
assert type(worldcfg['sequence']) == list

sb1name, sb1cfg = cfg.items()[1]
print sb1name,sb1cfg
# this fails because interpolation is global and before evaluation
#assert sb1cfg['height'] == want_height


from gegede.configuration import interpolate_value, interpolate
def test_interpolate_value():
Expand Down
1 change: 1 addition & 0 deletions tests/test_gdml.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def test_gegede_gdml():
obj = gegede.export.gdml.convert(geom)
s = gegede.export.gdml.dumps(obj)
assert s
print s
gegede.export.gdml.validate(s)


1 change: 1 addition & 0 deletions tests/test_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def test_ascending():

seen = set()
for vol in ascending(g.store.structure, top):
print vol
if vol.name in seen:
raise ValueError, "Seen again: %s" % vol.name
seen.add(vol.name)
Expand Down

0 comments on commit 842e2ee

Please sign in to comment.