コード例 #1
0
ファイル: test_parsers.py プロジェクト: pydap/pydap
 def test_consume_existing(self):
     """Test the consume method when the token exists."""
     parser = SimpleParser("Hello, World!")
     self.assertEqual(parser.consume("\w+"), "Hello")
     self.assertEqual(parser.consume(", "), ", ")
     self.assertEqual(parser.consume("\w+"), "World")
     self.assertEqual(parser.consume("!"), "!")
コード例 #2
0
ファイル: test_parsers.py プロジェクト: phrrngtn/pydap
 def test_consume_existing(self):
     """Test the consume method when the token exists."""
     parser = SimpleParser("Hello, World!")
     self.assertEqual(parser.consume("\w+"), "Hello")
     self.assertEqual(parser.consume(", "), ", ")
     self.assertEqual(parser.consume("\w+"), "World")
     self.assertEqual(parser.consume("!"), "!")
コード例 #3
0
ファイル: test_parsers.py プロジェクト: phrrngtn/pydap
 def test_consume_missing(self):
     """Test the consume method when the token does not exist."""
     parser = SimpleParser("Hello, World!")
     with self.assertRaises(Exception):
         parser.consume("\d+")
コード例 #4
0
ファイル: test_parsers.py プロジェクト: phrrngtn/pydap
 def test_peek_missing(self):
     """Test the peek method when the token does not exist."""
     parser = SimpleParser("Hello, World!")
     self.assertEqual(parser.peek("\d+"), "")
コード例 #5
0
ファイル: test_parsers.py プロジェクト: phrrngtn/pydap
 def test_peek_existing(self):
     """Test the peek method when the token exists."""
     parser = SimpleParser("Hello, World!")
     self.assertEqual(parser.peek("\w+"), "Hello")
コード例 #6
0
ファイル: dds.py プロジェクト: OPENDAP/pydap
 def consume(self, regexp):
     token = SimpleParser.consume(self, regexp)
     self.buffer = self.buffer.lstrip()
     return token
コード例 #7
0
ファイル: dds.py プロジェクト: OPENDAP/pydap
 def __init__(self, dds):
     SimpleParser.__init__(self, dds, re.IGNORECASE)
     self.dds = dds
コード例 #8
0
ファイル: test_parsers.py プロジェクト: pydap/pydap
 def test_consume_missing(self):
     """Test the consume method when the token does not exist."""
     parser = SimpleParser("Hello, World!")
     with self.assertRaises(Exception):
         parser.consume("\d+")
コード例 #9
0
ファイル: test_parsers.py プロジェクト: pydap/pydap
 def test_peek_missing(self):
     """Test the peek method when the token does not exist."""
     parser = SimpleParser("Hello, World!")
     self.assertEqual(parser.peek("\d+"), "")
コード例 #10
0
ファイル: test_parsers.py プロジェクト: pydap/pydap
 def test_peek_existing(self):
     """Test the peek method when the token exists."""
     parser = SimpleParser("Hello, World!")
     self.assertEqual(parser.peek("\w+"), "Hello")
コード例 #11
0
 def consume(self, regexp):
     token = SimpleParser.consume(self, regexp)
     self.buffer = self.buffer.lstrip()
     return token
コード例 #12
0
 def __init__(self, dds):
     SimpleParser.__init__(self, dds, re.IGNORECASE)
     self.dds = dds
コード例 #13
0
ファイル: das.py プロジェクト: OPENDAP/pydap
 def __init__(self, das, dataset):
     SimpleParser.__init__(self, das, re.IGNORECASE | re.VERBOSE | re.DOTALL)
     self.das = das
     self.dataset = dataset
コード例 #14
0
ファイル: das.py プロジェクト: openearth-attic/pydap
 def __init__(self, das, dataset):
     SimpleParser.__init__(self, das,
                           re.IGNORECASE | re.VERBOSE | re.DOTALL)
     self.das = das
     self.dataset = dataset