aboutsummaryrefslogtreecommitdiffstats
path: root/pig/tests/test_filter_software.py
blob: f0ea1b65e5859fb4e5a5a1e582c0c58dc267d11f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

import os
import unittest
from pighelper import PigTestHelper

def count_lines(s):
    return len([l for l in s.strip().split('\n') if len(l) > 0])

class TestFilterCDXSoftware(PigTestHelper):

    def test_tarballs(self):
        r = self.run_pig("filter-cdx-tarball.pig", "tests/files/tarballs.cdx")
        assert count_lines(r) == 2

    def test_source_code(self):
        r = self.run_pig("filter-cdx-source-code-crude.pig", "tests/files/sourcecode.cdx")
        assert count_lines(r) == 1