-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
do not eagerly convert expected values
- apply weak-equals comparison if necessary AFTER values have been fetched from db
- Loading branch information
Showing
3 changed files
with
89 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import unittest | ||
|
||
from library.mysql_query import weak_equals | ||
|
||
|
||
class WeakEquals(unittest.TestCase): | ||
|
||
def test_int_int(self): | ||
self.assertTrue(weak_equals(42, 42)) | ||
self.assertFalse(weak_equals(42, 43)) | ||
|
||
def test_string_string(self): | ||
self.assertTrue(weak_equals("a", "a")) | ||
self.assertFalse(weak_equals("a", "b")) | ||
|
||
def test_string_int(self): | ||
self.assertTrue(weak_equals("1", 1)) | ||
self.assertTrue(weak_equals(1, "1")) | ||
self.assertFalse(weak_equals("2", 1)) | ||
self.assertFalse(weak_equals(1, "2")) | ||
|
||
def test_string_long(self): | ||
self.assertTrue(weak_equals("1", 1L)) | ||
self.assertTrue(weak_equals(1L, "1")) | ||
self.assertFalse(weak_equals("2", 1L)) | ||
self.assertFalse(weak_equals(1L, "2")) | ||
|
||
def test_string_float(self): | ||
self.assertTrue(weak_equals("1.1", 1.1)) | ||
self.assertTrue(weak_equals(1.1, "1.1")) | ||
self.assertFalse(weak_equals("2", 1.1)) | ||
self.assertFalse(weak_equals(1.1, "2")) | ||
|
||
|