This repository has been archived by the owner on Nov 18, 2020. It is now read-only.
forked from cbernet/heppy
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename Identifier class to Idcoder issue #39
- Loading branch information
Alice
committed
Nov 15, 2017
1 parent
fcc9f7b
commit 3269125
Showing
24 changed files
with
148 additions
and
148 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
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
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,27 @@ | ||
import unittest | ||
import itertools | ||
from heppy.papas.data.idcoder import IdCoder | ||
|
||
class TestIdentifier(unittest.TestCase): | ||
|
||
def test_identifier(self): | ||
IdCoder.reset() | ||
uid = IdCoder.make_id(IdCoder.PFOBJECTTYPE.TRACK, 0, 's', 1.23456) | ||
id1 = IdCoder.make_id(IdCoder.PFOBJECTTYPE.TRACK, 1, 's', 12.782) | ||
|
||
self.assertTrue (IdCoder.pretty(id1) == 'ts1') | ||
ids = [] | ||
for i in range(0, 5) : | ||
uid = IdCoder.make_id(IdCoder.PFOBJECTTYPE.TRACK, i , 's', 2**(i-2) ) | ||
ids.append(uid) | ||
ids = sorted(ids, reverse = True) | ||
self.assertTrue(IdCoder.pretty(ids[0]) == 'ts4') | ||
self.assertTrue(IdCoder.get_value(ids[0]) == 4.0) | ||
self.assertTrue(IdCoder.pretty(ids[3]) == 'ts1') | ||
self.assertTrue(IdCoder.get_value(ids[3]) == 0.5) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() | ||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.