Changeset ef17ef2c in trunk for src/allmydata/test/test_happiness.py
- Timestamp:
- 2017-06-05T22:26:46Z (8 years ago)
- Branches:
- master
- Children:
- e68b331
- Parents:
- 42011e7
- git-author:
- meejah <meejah@…> (2017-01-20 21:58:49)
- git-committer:
- meejah <meejah@…> (2017-06-05 22:26:46)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/allmydata/test/test_happiness.py ¶
r42011e7 ref17ef2c 97 97 } 98 98 self.assertEqual(expected, places0) 99 100 def test_unhappy(self): 101 102 shares = { 103 'share1', 'share2', 'share3', 'share4', 'share5', 104 } 105 peers = { 106 'peer1', 'peer2', 'peer3', 'peer4', 107 } 108 readonly_peers = set() 109 peers_to_shares = { 110 } 111 112 places = happiness_upload.share_placement(peers, readonly_peers, shares, peers_to_shares) 113 happiness = happiness_upload.calculate_happiness(places) 114 self.assertEqual(4, happiness) 115 116 def test_calc_happy(self): 117 sharemap = { 118 0: set(["\x0e\xd6\xb3>\xd6\x85\x9d\x94')'\xf03:R\x88\xf1\x04\x1b\xa4", 119 '\x8de\x1cqM\xba\xc3\x0b\x80\x9aC<5\xfc$\xdc\xd5\xd3\x8b&', 120 '\xb9\xa3N\x80u\x9c_\xf7\x97FSS\xa7\xbd\x02\xf9f$:\t', 121 '\xc4\x83\x9eJ\x7f\xac| .\xc90\xf4b\xe4\x92\xbe\xaa\xe6\t\x80']), 122 1: set(['\xb9\xa3N\x80u\x9c_\xf7\x97FSS\xa7\xbd\x02\xf9f$:\t']), 123 2: set(['\xb9\xa3N\x80u\x9c_\xf7\x97FSS\xa7\xbd\x02\xf9f$:\t']), 124 3: set(['\xb9\xa3N\x80u\x9c_\xf7\x97FSS\xa7\xbd\x02\xf9f$:\t']), 125 4: set(['\xb9\xa3N\x80u\x9c_\xf7\x97FSS\xa7\xbd\x02\xf9f$:\t']), 126 5: set(['\xb9\xa3N\x80u\x9c_\xf7\x97FSS\xa7\xbd\x02\xf9f$:\t']), 127 6: set(['\xb9\xa3N\x80u\x9c_\xf7\x97FSS\xa7\xbd\x02\xf9f$:\t']), 128 7: set(['\xb9\xa3N\x80u\x9c_\xf7\x97FSS\xa7\xbd\x02\xf9f$:\t']), 129 8: set(['\xb9\xa3N\x80u\x9c_\xf7\x97FSS\xa7\xbd\x02\xf9f$:\t']), 130 9: set(['\xb9\xa3N\x80u\x9c_\xf7\x97FSS\xa7\xbd\x02\xf9f$:\t']), 131 } 132 happy = happiness_upload.calculate_happiness(sharemap) 133 self.assertEqual(2, happy)
Note: See TracChangeset
for help on using the changeset viewer.