From 6e8f3dbb2a9ec27e11acf7aa4c702277d1b8c124 Mon Sep 17 00:00:00 2001
From: Ladislav Lhotka <lhotka@nic.cz>
Date: Thu, 4 Feb 2016 13:55:29 +0100
Subject: [PATCH] Add test module for pytest.

---
 .gitignore                  |  1 +
 tests/module/test_parser.py | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 tests/module/test_parser.py

diff --git a/.gitignore b/.gitignore
index 472b889..78fee0a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+.cache
 *.pyc
 bin
 docs/_build
diff --git a/tests/module/test_parser.py b/tests/module/test_parser.py
new file mode 100644
index 0000000..abadeee
--- /dev/null
+++ b/tests/module/test_parser.py
@@ -0,0 +1,25 @@
+from yangson.module.parser import Parser
+
+class TestParser:
+
+    text = """module test { // Nice module
+      prefix t;
+      namespace /* URI follows */ \t'http://example.com/test';
+      leaf foo {
+        type string;
+        default "hi \\"doc\\"";
+      }
+      leaf bar {
+        mandatory true;
+        type uint8;
+      }
+    }
+    """
+
+    def test_parser(self):
+        p = Parser(self.text)
+        s = p.parse_module()
+        ss = s.find_all("leaf")
+        sss1 = ss[0].find1("default")
+        sss2 = ss[1].find1("type", "uint8")
+        assert sss1.keyword == "default"
-- 
GitLab