-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
order by popcon as classmethod, and tests
Signed-off-by: Lucas Severo <[email protected]> Signed-off-by: Lucas Mattioli <[email protected]>
- Loading branch information
1 parent
d408024
commit ecd33b4
Showing
2 changed files
with
27 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,33 @@ | ||
import unittest | ||
import pet.classifier | ||
from pet.classifier import Classifier | ||
import random | ||
import popcon | ||
|
||
|
||
class FakePackage(): | ||
def __init__(self): | ||
self.name = '' | ||
|
||
|
||
class TestPetClassifier(unittest.TestCase): | ||
|
||
def setUp(self): | ||
pass | ||
|
||
def test_something(self): | ||
pass | ||
def test_classify_popcon(self): | ||
|
||
package_libdigest_md4_perl = FakePackage() | ||
package_libdigest_md4_perl.name = 'libdigest-md4-perl' | ||
package_libsharyanto_utils_perl = FakePackage() | ||
package_libsharyanto_utils_perl.name = 'libsharyanto-utils-perl' | ||
|
||
packages = [package_libdigest_md4_perl, package_libsharyanto_utils_perl] | ||
random.shuffle(packages) | ||
ordered_packages = Classifier.order_packages_by_popcon(packages) | ||
|
||
for i in range(0, len(packages) - 1): | ||
package1 = popcon.package(ordered_packages[i].name) | ||
package2 = popcon.package(ordered_packages[i + 1].name) | ||
self.assertGreaterEqual(package1[ordered_packages[i].name], | ||
package2[ordered_packages[i + 1].name]) |