d9d59d70d6c96300d23235c4de6aef9ba7b4b9f8
4 from bulletml
import BulletML
, Bullet
, bulletyaml
5 from tests
import TestCase
, add
7 class Texamples_xml(TestCase
):
10 class Texamples_yaml(TestCase
):
13 class Texamples_repr(TestCase
):
16 class Texamples_run(TestCase
):
19 for filename
in glob
.glob("examples/*/*.xml"):
20 basename
= os
.path
.basename(filename
)[:-4].replace("-", "_")
22 def test_xml(self
, filename
=filename
):
23 BulletML
.FromDocument(open(filename
, "rU"))
24 setattr(Texamples_xml
, "test_" + basename
, test_xml
)
31 def test_yaml(self
, filename
=filename
):
32 doc
= BulletML
.FromDocument(open(filename
, "rU"))
33 doc
= yaml
.load(yaml
.dump(doc
))
34 doc
= yaml
.load(yaml
.dump(doc
))
35 setattr(Texamples_yaml
, "test_" + basename
, test_yaml
)
37 def test_repr(self
, filename
=filename
):
38 doc
= BulletML
.FromDocument(open(filename
, "rU"))
40 setattr(Texamples_repr
, "test_" + basename
, test_repr
)
42 def test_run(self
, filename
=filename
):
43 doc
= BulletML
.FromDocument(open(filename
, "rU"))
44 bullets
= [Bullet
.FromDocument(doc
)]
46 for bullet
in bullets
:
47 bullets
.extend(bullet
.step())
48 setattr(Texamples_run
, "test_" + basename
, test_run
)