aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/all_tests.py11
-rw-r--r--test/input.py (renamed from test/10-input.py)69
-rw-r--r--test/load.py (renamed from test/00.load.py)0
-rw-r--r--test/output.py (renamed from test/30-output.py)0
-rw-r--r--test/pod_coverage.py (renamed from test/pod-coverage.py)0
-rw-r--r--test/reader.py (renamed from test/20-reader.py)0
-rw-r--r--test/writer.py (renamed from test/40-writer.py)0
7 files changed, 45 insertions, 35 deletions
diff --git a/test/all_tests.py b/test/all_tests.py
new file mode 100644
index 0000000..f4f3bbe
--- /dev/null
+++ b/test/all_tests.py
@@ -0,0 +1,11 @@
+import unittest
+import load, input, reader, output, writer
+
+add_tests_from_class = unittest.TestLoader().loadTestsFromTestCase
+
+suite = unittest.TestSuite()
+suite.addTest(add_tests_from_class(load.TestBasics))
+suite.addTest(add_tests_from_class(TestHappyPath))
+suite.addTest(add_tests_from_class(TestBadPath))
+suite.addTest(add_tests_from_class(TestPiglitData))
+suite.addTest(add_tests_from_class(TestMainArgsMgmt))
diff --git a/test/10-input.py b/test/input.py
index 5ec8d96..8f7e553 100644
--- a/test/10-input.py
+++ b/test/input.py
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
+import logging
import unittest
+import yamlish
IN = """
---
@@ -66,38 +68,35 @@ OUT = {
class TestInput(unittest.TestCase):
"""FIXME description of this class"""
def test_reader(self):
- #my @lines = @$in;
- #my $scalar = join("\n", @lines) . "\n";
- #
- #my @source = (
- # {
- # name= > 'Array reference',
- # source= > $in,
- # },
- # {
- # name= > 'Closure',
- # source= > sub { shift @lines },
- # },
- # {
- # name= > 'Scalar',
- # source= > $scalar,
- # },
- # {
- # name= > 'Scalar ref',
- # source= > \$scalar,
- # },
- #);
- #
- #for my $src (@source) {
- # my $name = $src -> {name};
- # ok my $yaml = Data::YAML::Reader -> new, "$name: Created";
- # isa_ok $yaml, 'Data::YAML::Reader';
- #
- # my $got = eval { $yaml -> read($src -> {source}) };
- # unless (is_deeply $got, $out, "$name: Result matches") {
- # local $Data::Dumper::Useqq = $Data::Dumper::Useqq = 1;
- # diag(Data::Dumper -> Dump([$got], ['$got']));
- # diag(Data::Dumper -> Dump([$out], ['$expected']));
- # }
- #}
- pass
+ scalar = IN
+ source = [
+ {
+ "name": 'Array reference',
+ "source": IN.split("\n"),
+ },
+# {
+# "name": 'Closure',
+# "source": sub { shift @lines },
+# },
+ {
+ "name": 'Scalar',
+ "source": IN,
+ }
+ ]
+
+ for src in source:
+ name = src['name']
+ yaml = yamlish.Reader()
+ self.assert_(True, "$name: Created")
+ self.assert_(isinstance(yaml, yamlish.Reader))
+
+ #my $got = eval { $yaml -> read($src -> {source}) };
+ got = yaml.read(src['source'])
+ self.assertEqual(got, OUT, """%s: Result matches
+ expected = %s
+
+ observed = %s
+ """ % (name, OUT, got))
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/test/00.load.py b/test/load.py
index e4f3f5f..e4f3f5f 100644
--- a/test/00.load.py
+++ b/test/load.py
diff --git a/test/30-output.py b/test/output.py
index 56cfb0a..56cfb0a 100644
--- a/test/30-output.py
+++ b/test/output.py
diff --git a/test/pod-coverage.py b/test/pod_coverage.py
index c412996..c412996 100644
--- a/test/pod-coverage.py
+++ b/test/pod_coverage.py
diff --git a/test/20-reader.py b/test/reader.py
index fc6806f..fc6806f 100644
--- a/test/20-reader.py
+++ b/test/reader.py
diff --git a/test/40-writer.py b/test/writer.py
index 4d70780..4d70780 100644
--- a/test/40-writer.py
+++ b/test/writer.py