示例#1
0
 def test__nonzero__should_return_True__for_identical_parameters(self):
     r1 = Record(MockExecutable(), MockRepository(), "test.py", 999, MockLaunchMode(), MockDataStore(), {"a": 2})
     time.sleep(1)
     r2 = Record(MockExecutable(), MockRepository(), "test.py", 999, MockLaunchMode(), MockDataStore(), {"a": 2})
     r1.dependencies = []
     r2.dependencies = []
     diff = RecordDifference(r1, r2)
     self.assertEqual(diff.executable_differs, False)
     self.assertEqual(diff.code_differs, False)
     self.assertEqual(diff.parameters_differ, False)
     self.assertEqual(diff.output_data_differ, False)
     self.assertEqual(diff.__bool__(), False)
示例#2
0
 def test__nonzero__should_return_True__for_identical_parameters(self):
     r1 = Record(MockExecutable(), MockRepository(), "test.py", 999,
                 MockLaunchMode(), MockDataStore(), {"a": 2})
     time.sleep(1)
     r2 = Record(MockExecutable(), MockRepository(), "test.py", 999,
                 MockLaunchMode(), MockDataStore(), {"a": 2})
     r1.dependencies = []
     r2.dependencies = []
     diff = RecordDifference(r1, r2)
     self.assertEqual(diff.executable_differs, False)
     self.assertEqual(diff.code_differs, False)
     self.assertEqual(diff.parameters_differ, False)
     self.assertEqual(diff.output_data_differ, False)
     self.assertEqual(diff.__bool__(), False)
示例#3
0
 def test__init(self):
     r1 = Record(MockExecutable(), MockRepository(), "test.py", 999,
                 MockLaunchMode(), MockDataStore())
     time.sleep(1)
     r2 = Record(MockExecutable(), MockRepository(), "test.py", 999,
                 MockLaunchMode(), MockDataStore())
     diff = RecordDifference(r1, r2)
示例#4
0
 def test__dependency_differences(self):
     r1 = Record(MockExecutable(), MockRepository(), "test.py", 999,
                 MockLaunchMode(), MockDataStore())
     time.sleep(1)
     r2 = Record(MockExecutable(), MockRepository(), "test.py", 999,
                 MockLaunchMode(), MockDataStore())
     r1.dependencies = [MockDependency("foo"), MockDependency("bar")]
     r2.dependencies = [MockDependency("bar"), MockDependency("eric")]
     diff = RecordDifference(r1, r2)
     diff.dependency_differences
示例#5
0
 def test__repr(self):
     r1 = Record(MockExecutable("1"), MockRepository(), "test.py",
                 999, MockLaunchMode(), MockDataStore(), {"a": 3}, label="A")
     time.sleep(1)
     r2 = Record(MockExecutable("2"), MockRepository(), "test.py",
                 999, MockLaunchMode(), MockDataStore(), {"a": 2}, label="B")
     r1.dependencies = [MockDependency("foo"), MockDependency("bar")]
     r2.dependencies = [MockDependency("bar"), MockDependency("eric")]
     diff = RecordDifference(r1, r2)
     self.assertEqual(repr(diff), "RecordDifference(A, B):XCP")
示例#6
0
文件: views.py 项目: pv/sumatra
def compare_records(request, project):
    record_labels = [request.GET['a'], request.GET['b']]
    db_records = Record.objects.filter(label__in=record_labels, project__id=project)
    records = [r.to_sumatra() for r in db_records]
    diff = RecordDifference(*records)
    context = {'db_records': db_records,
               'diff': diff,
               'project': Project.objects.get(pk=project)}
    if diff.input_data_differ:
        context['input_data_pairs'] = pair_datafiles(diff.recordA.input_data, diff.recordB.input_data)
    if diff.output_data_differ:
        context['output_data_pairs'] = pair_datafiles(diff.recordA.output_data, diff.recordB.output_data)
    return render_to_response("record_comparison.html", context)