コード例 #1
0
    def test_from_string_full(self):
        text = '''<STREAM location="path" cycle="123" cycle_gzip="NO">
  <FILTER>gzip</FILTER>
  <FILTER>bzip2</FILTER>
</STREAM>'''
        log = Stream.from_string(text)
        right = Stream('path', 123, False, ['gzip', 'bzip2'])
        self.assertEqual(log, right)
コード例 #2
0
    def test_from_string_full(self):
        text = '''<STREAM location="path" cycle="123" cycle_gzip="NO">
  <FILTER>gzip</FILTER>
  <FILTER>bzip2</FILTER>
</STREAM>'''
        log = Stream.from_string(text)
        right = Stream('path', 123, False, ['gzip', 'bzip2'])
        self.assertEqual(log, right)
コード例 #3
0
    def test_stream(self):
        text = '''
<STREAM custom="unknown">
  abc
  <UNKNOWN>
    <CUSTOM />
  </UNKNOWN>
</STREAM>'''
        stream = Stream.from_string(text)
        tree = stream.to_lxml_element()
        self.assertEqual('unknown', tree.get('custom'))
        unknown = tree.findall('UNKNOWN')
        self.assertEqual(1, len(unknown))
        unknown = unknown[0]
        custom = list(unknown)
        self.assertEqual(1, len(custom))
        custom = custom[0]
        self.assertEqual('CUSTOM', custom.tag)
コード例 #4
0
    def test_stream(self):
        text = '''
<STREAM custom="unknown">
  abc
  <UNKNOWN>
    <CUSTOM />
  </UNKNOWN>
</STREAM>'''
        stream = Stream.from_string(text)
        tree = stream.to_lxml_element()
        self.assertEqual('unknown', tree.get('custom'))
        unknown = tree.findall('UNKNOWN')
        self.assertEqual(1, len(unknown))
        unknown = unknown[0]
        custom = list(unknown)
        self.assertEqual(1, len(custom))
        custom = custom[0]
        self.assertEqual('CUSTOM', custom.tag)
コード例 #5
0
 def test_from_string_filters(self):
     text = '<STREAM><FILTER>gzip</FILTER><FILTER>bzip2</FILTER></STREAM>'
     log = Stream.from_string(text)
     right = Stream(filters=['gzip', 'bzip2'])
     self.assertEqual(log, right)
コード例 #6
0
 def test_from_string_filters(self):
     text = '<STREAM><FILTER>gzip</FILTER><FILTER>bzip2</FILTER></STREAM>'
     log = Stream.from_string(text)
     right = Stream(filters = ['gzip', 'bzip2'])
     self.assertEqual(log, right)
コード例 #7
0
 def test_from_string_location(self):
     text = '<STREAM location="path" />'
     log = Stream.from_string(text)
     right = Stream(location='path')
     self.assertEqual(log, right)
コード例 #8
0
 def test_to_string_filters(self):
     log = Stream(filters=['gzip', 'bzip2'])
     copy = Stream.from_string(str(log))
     self.assertEqual(log, copy)
コード例 #9
0
 def test_to_string_cycle(self):
     log = Stream(cycle=123)
     copy = Stream.from_string(str(log))
     self.assertEqual(log, copy)
コード例 #10
0
 def test_to_string_full(self):
     log = Stream('path', 123, False, ['gzip', 'bzip2'])
     copy = Stream.from_string(str(log))
     self.assertEqual(log, copy)
コード例 #11
0
 def test_to_string_filters(self):
     log = Stream(filters = ['gzip', 'bzip2'])
     copy = Stream.from_string(str(log))
     self.assertEqual(log, copy)
コード例 #12
0
 def test_to_string_cycle_gzip(self):
     log = Stream(cycle_gzip = False)
     copy = Stream.from_string(str(log))
     self.assertEqual(log, copy)
コード例 #13
0
 def test_to_string_cycle(self):
     log = Stream(cycle = 123)
     copy = Stream.from_string(str(log))
     self.assertEqual(log, copy)
コード例 #14
0
 def test_to_string_location(self):
     log = Stream(location = 'path')
     copy = Stream.from_string(str(log))
     self.assertEqual(log, copy)
コード例 #15
0
 def test_to_string(self):
     log = Stream()
     copy = Stream.from_string(str(log))
     self.assertEqual(log, copy)
コード例 #16
0
 def test_to_string(self):
     log = Stream()
     copy = Stream.from_string(str(log))
     self.assertEqual(log, copy)
コード例 #17
0
 def test_to_string_location(self):
     log = Stream(location='path')
     copy = Stream.from_string(str(log))
     self.assertEqual(log, copy)
コード例 #18
0
 def test_from_string(self):
     text = '<STREAM />'
     log = Stream.from_string(text)
     right = Stream()
     self.assertEqual(log, right)
コード例 #19
0
 def test_to_string_cycle_gzip(self):
     log = Stream(cycle_gzip=False)
     copy = Stream.from_string(str(log))
     self.assertEqual(log, copy)
コード例 #20
0
 def test_from_string_location(self):
     text = '<STREAM location="path" />'
     log = Stream.from_string(text)
     right = Stream(location = 'path')
     self.assertEqual(log, right)
コード例 #21
0
 def test_to_string_full(self):
     log = Stream('path', 123, False, ['gzip', 'bzip2'])
     copy = Stream.from_string(str(log))
     self.assertEqual(log, copy)
コード例 #22
0
 def test_from_string_cycle(self):
     text = '<STREAM cycle="123" />'
     log = Stream.from_string(text)
     right = Stream(cycle = 123)
     self.assertEqual(log, right)
コード例 #23
0
 def test_from_string(self):
     text = '<STREAM />'
     log = Stream.from_string(text)
     right = Stream()
     self.assertEqual(log, right)
コード例 #24
0
 def test_from_string_cycle_gzip(self):
     text = '<STREAM cycle_gzip="NO" />'
     log = Stream.from_string(text)
     right = Stream(cycle_gzip=False)
     self.assertEqual(log, right)
コード例 #25
0
 def test_from_string_cycle(self):
     text = '<STREAM cycle="123" />'
     log = Stream.from_string(text)
     right = Stream(cycle=123)
     self.assertEqual(log, right)
コード例 #26
0
 def test_from_string_cycle_gzip(self):
     text = '<STREAM cycle_gzip="NO" />'
     log = Stream.from_string(text)
     right = Stream(cycle_gzip = False)
     self.assertEqual(log, right)