Commits

Rune Halvorsen committed 5fbae58

Do sensible testing on floats

  • Participants
  • Parent commits bea0cd0

Comments (0)

Files changed (1)

File tests/test_reference.py

 # -*- coding: utf-8 -*-
 
 import pblight as pb
+from nose.tools import assert_almost_equal
 import unitmsg
 import referencetool
 
+
+
 def smoke_test_roundtrip():
     class TestMsg(pb.ProtoBufMessage):
         s = pb.StringField(1)
         r2.ParseFromString(p1.serialize())
 
         for key, val in kwargs.items():
-            print getattr(p2, key), getattr(r2, key), key
-            assert getattr(p2, key) == getattr(r2, key) == val
+            if isinstance(val, float):
+                assert_almost_equal(getattr(p2, key), val)
+            else:
+                assert getattr(p2, key) == getattr(r2, key) == val
 
 
     testprop(optional_int32=1)