예제 #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
 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
 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
 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
 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
 def __init__(self, das, dataset):
     SimpleParser.__init__(self, das,
                           re.IGNORECASE | re.VERBOSE | re.DOTALL)
     self.das = das
     self.dataset = dataset