Skip to content

Commit

Permalink
Corrected testes for Python 2.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
cfournie committed Jul 6, 2013
1 parent 2cc9c1f commit 157128a
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion segeval/agreement/kappa_test.py
Expand Up @@ -84,7 +84,7 @@ def test_fleiss_kappa_complete(self):
'''
data_complete = COMPLETE_AGREEMENT
kappa = fleiss_kappa_linear(data_complete)
self.assertEqual(kappa, 1.0)
self.assertEqual(kappa, Decimal('1.0'))

def test_exception_coders(self):
'''
Expand Down
2 changes: 1 addition & 1 deletion segeval/agreement/pi_test.py
Expand Up @@ -83,7 +83,7 @@ def test_fleiss_pi_complete(self):

data_complete = COMPLETE_AGREEMENT
pi = fleiss_pi_linear(data_complete)
self.assertEqual(pi, 1.0)
self.assertEqual(pi, Decimal('1'))

def test_exception_coders(self):
'''
Expand Down
14 changes: 7 additions & 7 deletions segeval/similarity/boundary_test.py
Expand Up @@ -25,7 +25,7 @@ def test_fn(self):
Test false negative.
'''
value = boundary_similarity([2, 3, 6], [5, 6])
self.assertEqual(0.5, value)
self.assertEqual(Decimal('0.5'), value)

def test_fp(self):
'''
Expand All @@ -39,7 +39,7 @@ def test_near_miss(self):
Test near miss.
'''
value = boundary_similarity([2, 3, 6], [2, 2, 7])
self.assertEqual(0.75, value)
self.assertEqual(Decimal('0.75'), value)

def test_one_minus(self):
'''
Expand All @@ -60,7 +60,7 @@ def test_clustered_fps(self):
Test clustered fps.
'''
value = boundary_similarity([2, 3, 6], [1, 1, 3, 1, 5])
self.assertEqual(0.5, value)
self.assertEqual(Decimal('0.5'), value)

def test_positions(self):
'''
Expand All @@ -70,7 +70,7 @@ def test_positions(self):
b = [1,1,1,1,2,2,2,2,3,3,3,3,3]
value = boundary_similarity(a, b, boundary_format=
BoundaryFormat.position)
self.assertEqual(0, value)
self.assertEqual(Decimal('0'), value)

def test_format_exception(self):
'''
Expand Down Expand Up @@ -104,9 +104,9 @@ def test_multiple_boundary_types(self):
Test false negative.
'''
value = summarize(boundary_similarity(MULTIPLE_BOUNDARY_TYPES))
self.assertEqual((0.375,
0.125,
0.015625,
self.assertEqual((Decimal('0.375'),
Decimal('0.125'),
Decimal('0.015625'),
Decimal('0.08838834764831844055010554528'),
2),
value)
Expand Down
2 changes: 1 addition & 1 deletion segeval/similarity/test.py
Expand Up @@ -33,7 +33,7 @@ def test_boundary_confusion_matrix(self):
self.assertEqual(cm[2][None], 0)
self.assertEqual(cm[2][1], 1)
self.assertEqual(cm[1][2], 0)
self.assertEqual(cm[1][1], 1.5)
self.assertEqual(cm[1][1], Decimal('1.5'))
self.assertEqual(cm[2][2], 0)

def test_boundary_statistics(self):
Expand Down
7 changes: 4 additions & 3 deletions segeval/similarity/weight_test.py
Expand Up @@ -4,6 +4,7 @@
.. moduleauthor:: Chris Fournier <chris.m.fournier@gmail.com>
'''
import unittest
from decimal import Decimal
from . import (weight_s_scale, weight_t_scale)


Expand All @@ -20,7 +21,7 @@ def test_weight_t_scale(self):
'''
transpositions = [[1,2], [1,3], [1,4]]
weight = weight_t_scale(transpositions, 4)
self.assertEqual(weight, 1.5)
self.assertEqual(weight, Decimal('1.5'))

def test_weight_s_scale(self):
'''
Expand All @@ -29,6 +30,6 @@ def test_weight_s_scale(self):
'''
substitutions = [[1,2], [1,3], [1,4]]
weight = weight_s_scale(substitutions, 4)
self.assertEqual(weight, 1.5)
self.assertEqual(weight, Decimal('1.5'))
weight = weight_s_scale(substitutions, 5, 2)
self.assertEqual(weight, 1.5)
self.assertEqual(weight, Decimal('1.5'))
4 changes: 2 additions & 2 deletions segeval/test.py
Expand Up @@ -196,5 +196,5 @@ def test_convert_masses_to_positions(self):
Test convert_masses_to_positions.
'''

self.assertAlmostEquals((1,1,1,1,2,2),
convert_masses_to_positions((4,2)))
self.assertEquals((1,1,1,1,2,2),
convert_masses_to_positions((4,2)))
8 changes: 4 additions & 4 deletions segeval/window/pk_test.py
Expand Up @@ -52,8 +52,8 @@ def test_identical(self):
b = [1,1,1,1,1,2,2,2,3,3,3,3,3]
one_minus_kwargs = dict(TestPk.kwargs)
one_minus_kwargs['one_minus'] = True
self.assertEqual(pk(a, b, **self.kwargs), 0.0)
self.assertEqual(pk(a, b, **one_minus_kwargs), 1.0)
self.assertEqual(pk(a, b, **self.kwargs), Decimal('0.0'))
self.assertEqual(pk(a, b, **one_minus_kwargs), Decimal('1.0'))

def test_no_boundaries(self):
'''
Expand Down Expand Up @@ -87,8 +87,8 @@ def test_all_and_no_boundaries(self):

a = [1,2,3,4,5,6,7,8,9,10,11,12,13]
b = [1,1,1,1,1,1,1,1,1,1,1,1,1]
self.assertEqual(pk(a, b, **self.kwargs), 1.0)
self.assertEqual(pk(b, a, **self.kwargs), 1.0)
self.assertEqual(pk(a, b, **self.kwargs), Decimal('1.0'))
self.assertEqual(pk(b, a, **self.kwargs), Decimal('1.0'))

def test_translated_boundary(self):
'''
Expand Down
10 changes: 5 additions & 5 deletions segeval/window/windowdiff_test.py
Expand Up @@ -37,7 +37,7 @@ def test_identical(self):

a = [1,1,1,1,1,2,2,2,3,3,3,3,3]
b = [1,1,1,1,1,2,2,2,3,3,3,3,3]
self.assertEqual(window_diff(a, b, **self.kwargs), 0.0)
self.assertEqual(window_diff(a, b, **self.kwargs), Decimal('0.0'))

def test_no_boundaries(self):
'''
Expand Down Expand Up @@ -82,9 +82,9 @@ def test_translated_boundary(self):
a = [1,1,1,1,1,2,2,2,3,3,3,3,3]
b = [1,1,1,1,2,2,2,2,3,3,3,3,3]
self.assertAlmostEqual(window_diff(a, b, **self.kwargs), # k = 2
Decimal(2.0 / 11.0))
Decimal('2.0') / Decimal('11.0'))
self.assertAlmostEqual(window_diff(b, a, **self.kwargs),
Decimal(2.0 / 11.0))
Decimal('2.0') / Decimal('11.0'))

def test_extra_boundary(self):
'''
Expand All @@ -94,9 +94,9 @@ def test_extra_boundary(self):
a = [1,1,1,1,1,2,2,2,3,3,3,3,3]
b = [1,1,1,1,1,2,3,3,4,4,4,4,4]
self.assertAlmostEqual(window_diff(a, b, **self.kwargs),
Decimal(2.0 / 11.0))
Decimal('2.0') / Decimal('11.0'))
self.assertAlmostEqual(window_diff(b, a, **self.kwargs),
Decimal(2.0 / 11.0))
Decimal('2.0') / Decimal('11.0'))

def test_full_miss_and_misaligned(self):
'''
Expand Down

0 comments on commit 157128a

Please sign in to comment.