Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
compares two hex list files and if same -> outputs same file, else error

        def compare(filename_a, filename_b, filename_out):
    """ compares two hex list files and if same -> outputs same file, else error"""

    with open(filename_a, 'r') as fa, open(filename_b, 'r') as fb:
        count_a = int(fa.readline())
        count_b = int(fb.readline())

        assert count_a == count_b, "Different sizes: count_a(%d) != count_b(%d)" % (count_a, count_b)

        for i in xrange(count_a):
            a = int(fa.readline(), 16)
            b = int(fb.readline(), 16)
            assert a == b, "Different numbers on line#%d: a=%d != b=%d" % (i, a, b)

    shutil.copyfile(filename_a, filename_out)
        


src/s/b/sbgsdk-0.5.4/sbgsdk/tests/test_tools/comparator/comparator_test.py   sbgsdk(Download)
def test_compare_random():
    count = 1000
    generator.generate('random_a.txt', count, 'random')
    generator.generate('random_b.txt', count, 'random')
    comparator.compare('random_a.txt', 'random_b.txt', 'random_c.txt')
def test_compare_same():
    count = 1000
    generator.generate('same_a.txt', count, 'same', 45)
    generator.generate('same_b.txt', count, 'same', 45)
    comparator.compare('same_a.txt', 'same_b.txt', 'same_c.txt')
def test_compare_same_diff_length():
    generator.generate('same_a.txt', 1000, 'same', 45)
    generator.generate('same_b.txt', 1001, 'same', 45)
    comparator.compare('same_a.txt', 'same_b.txt', 'same_c.txt')
 

src/s/b/sbgsdk-0.5.4/sbgsdk/tests/test_wrappers/blue_comparator.py   sbgsdk(Download)
    def execute(self):
        inputs, outputs = self.inputs, self.outputs
        filename = str(uuid.uuid4()) + '.txt'
        assert len(inputs.inputA) == 2, 'input len = %s' % len(inputs.inputA)
        comparator.compare(inputs.inputA[0], inputs.inputA[1], filename)