trackler 2.1.0.9 → 2.1.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (230) hide show
  1. checksums.yaml +4 -4
  2. data/common/exercises/perfect-numbers/description.md +2 -2
  3. data/common/exercises/phone-number/canonical-data.json +1 -7
  4. data/common/exercises/tournament/canonical-data.json +96 -21
  5. data/common/exercises/tournament/description.md +0 -5
  6. data/lib/trackler/version.rb +1 -1
  7. data/tracks/coq/README.md +6 -8
  8. data/tracks/coq/exercises/hello-world/example.v +3 -0
  9. data/tracks/coq/exercises/hello-world/hello-world.v +3 -0
  10. data/tracks/coq/exercises/rna-transcription/DNA.v +4 -0
  11. data/tracks/coq/exercises/rna-transcription/example.v +15 -0
  12. data/tracks/coq/exercises/rna-transcription/rna-transcription.v +5 -0
  13. data/tracks/coq/exercises/tautology/description.md +1 -0
  14. data/tracks/coq/exercises/tautology/example.v +4 -0
  15. data/tracks/coq/exercises/tautology/tautology.v +4 -0
  16. data/tracks/haskell/exercises/accumulate/package.yaml +1 -0
  17. data/tracks/haskell/exercises/accumulate/test/Tests.hs +0 -3
  18. data/tracks/haskell/exercises/acronym/package.yaml +1 -0
  19. data/tracks/haskell/exercises/acronym/test/Tests.hs +0 -5
  20. data/tracks/haskell/exercises/all-your-base/package.yaml +1 -0
  21. data/tracks/haskell/exercises/all-your-base/test/Tests.hs +0 -2
  22. data/tracks/haskell/exercises/allergies/package.yaml +1 -0
  23. data/tracks/haskell/exercises/allergies/test/Tests.hs +0 -2
  24. data/tracks/haskell/exercises/alphametics/package.yaml +1 -0
  25. data/tracks/haskell/exercises/alphametics/test/Tests.hs +0 -2
  26. data/tracks/haskell/exercises/anagram/package.yaml +1 -0
  27. data/tracks/haskell/exercises/anagram/test/Tests.hs +0 -2
  28. data/tracks/haskell/exercises/atbash-cipher/package.yaml +1 -0
  29. data/tracks/haskell/exercises/atbash-cipher/test/Tests.hs +0 -2
  30. data/tracks/haskell/exercises/bank-account/package.yaml +1 -0
  31. data/tracks/haskell/exercises/bank-account/test/Tests.hs +0 -3
  32. data/tracks/haskell/exercises/beer-song/package.yaml +1 -0
  33. data/tracks/haskell/exercises/binary/package.yaml +1 -0
  34. data/tracks/haskell/exercises/binary/test/Tests.hs +0 -1
  35. data/tracks/haskell/exercises/binary-search-tree/package.yaml +1 -0
  36. data/tracks/haskell/exercises/binary-search-tree/test/Tests.hs +0 -3
  37. data/tracks/haskell/exercises/bob/package.yaml +1 -0
  38. data/tracks/haskell/exercises/bob/test/Tests.hs +0 -2
  39. data/tracks/haskell/exercises/bowling/package.yaml +1 -0
  40. data/tracks/haskell/exercises/bowling/test/Tests.hs +0 -2
  41. data/tracks/haskell/exercises/bracket-push/package.yaml +1 -0
  42. data/tracks/haskell/exercises/bracket-push/test/Tests.hs +1 -6
  43. data/tracks/haskell/exercises/change/package.yaml +1 -0
  44. data/tracks/haskell/exercises/change/test/Tests.hs +0 -2
  45. data/tracks/haskell/exercises/clock/package.yaml +1 -0
  46. data/tracks/haskell/exercises/clock/test/Tests.hs +0 -2
  47. data/tracks/haskell/exercises/connect/package.yaml +1 -0
  48. data/tracks/haskell/exercises/connect/test/Tests.hs +0 -2
  49. data/tracks/haskell/exercises/crypto-square/package.yaml +1 -0
  50. data/tracks/haskell/exercises/crypto-square/test/Tests.hs +0 -2
  51. data/tracks/haskell/exercises/custom-set/package.yaml +1 -0
  52. data/tracks/haskell/exercises/custom-set/test/Tests.hs +0 -3
  53. data/tracks/haskell/exercises/difference-of-squares/package.yaml +1 -0
  54. data/tracks/haskell/exercises/difference-of-squares/test/Tests.hs +0 -3
  55. data/tracks/haskell/exercises/dominoes/package.yaml +1 -0
  56. data/tracks/haskell/exercises/dominoes/test/Tests.hs +0 -2
  57. data/tracks/haskell/exercises/etl/package.yaml +1 -0
  58. data/tracks/haskell/exercises/etl/test/Tests.hs +0 -2
  59. data/tracks/haskell/exercises/food-chain/package.yaml +1 -0
  60. data/tracks/haskell/exercises/forth/package.yaml +1 -0
  61. data/tracks/haskell/exercises/forth/test/Tests.hs +0 -2
  62. data/tracks/haskell/exercises/gigasecond/package.yaml +1 -0
  63. data/tracks/haskell/exercises/gigasecond/test/Tests.hs +0 -3
  64. data/tracks/haskell/exercises/go-counting/package.yaml +1 -0
  65. data/tracks/haskell/exercises/go-counting/test/Tests.hs +0 -3
  66. data/tracks/haskell/exercises/grade-school/package.yaml +1 -0
  67. data/tracks/haskell/exercises/grade-school/test/Tests.hs +0 -3
  68. data/tracks/haskell/exercises/grains/package.yaml +1 -0
  69. data/tracks/haskell/exercises/grains/test/Tests.hs +0 -2
  70. data/tracks/haskell/exercises/hamming/package.yaml +1 -0
  71. data/tracks/haskell/exercises/hamming/test/Tests.hs +0 -2
  72. data/tracks/haskell/exercises/hello-world/package.yaml +1 -0
  73. data/tracks/haskell/exercises/hexadecimal/package.yaml +1 -0
  74. data/tracks/haskell/exercises/hexadecimal/test/Tests.hs +0 -3
  75. data/tracks/haskell/exercises/house/package.yaml +1 -0
  76. data/tracks/haskell/exercises/kindergarten-garden/package.yaml +1 -0
  77. data/tracks/haskell/exercises/kindergarten-garden/test/Tests.hs +0 -3
  78. data/tracks/haskell/exercises/largest-series-product/package.yaml +1 -0
  79. data/tracks/haskell/exercises/largest-series-product/test/Tests.hs +0 -3
  80. data/tracks/haskell/exercises/leap/package.yaml +1 -0
  81. data/tracks/haskell/exercises/leap/test/Tests.hs +0 -2
  82. data/tracks/haskell/exercises/lens-person/package.yaml +1 -0
  83. data/tracks/haskell/exercises/lens-person/test/Tests.hs +0 -3
  84. data/tracks/haskell/exercises/linked-list/package.yaml +1 -0
  85. data/tracks/haskell/exercises/linked-list/test/Tests.hs +0 -3
  86. data/tracks/haskell/exercises/list-ops/package.yaml +1 -0
  87. data/tracks/haskell/exercises/list-ops/test/Tests.hs +0 -3
  88. data/tracks/haskell/exercises/luhn/package.yaml +1 -0
  89. data/tracks/haskell/exercises/luhn/test/Tests.hs +0 -3
  90. data/tracks/haskell/exercises/matrix/package.yaml +1 -0
  91. data/tracks/haskell/exercises/matrix/test/Tests.hs +0 -3
  92. data/tracks/haskell/exercises/meetup/package.yaml +1 -0
  93. data/tracks/haskell/exercises/meetup/test/Tests.hs +0 -2
  94. data/tracks/haskell/exercises/minesweeper/package.yaml +1 -0
  95. data/tracks/haskell/exercises/minesweeper/test/Tests.hs +0 -3
  96. data/tracks/haskell/exercises/nth-prime/package.yaml +1 -0
  97. data/tracks/haskell/exercises/nth-prime/test/Tests.hs +0 -2
  98. data/tracks/haskell/exercises/nucleotide-count/package.yaml +1 -0
  99. data/tracks/haskell/exercises/nucleotide-count/test/Tests.hs +0 -2
  100. data/tracks/haskell/exercises/ocr-numbers/package.yaml +1 -0
  101. data/tracks/haskell/exercises/ocr-numbers/test/Tests.hs +0 -3
  102. data/tracks/haskell/exercises/octal/package.yaml +1 -0
  103. data/tracks/haskell/exercises/octal/test/Tests.hs +0 -3
  104. data/tracks/haskell/exercises/palindrome-products/package.yaml +1 -0
  105. data/tracks/haskell/exercises/palindrome-products/test/Tests.hs +0 -3
  106. data/tracks/haskell/exercises/pangram/package.yaml +1 -0
  107. data/tracks/haskell/exercises/pangram/test/Tests.hs +0 -5
  108. data/tracks/haskell/exercises/parallel-letter-frequency/package.yaml +1 -0
  109. data/tracks/haskell/exercises/parallel-letter-frequency/test/Tests.hs +0 -3
  110. data/tracks/haskell/exercises/pascals-triangle/package.yaml +1 -0
  111. data/tracks/haskell/exercises/pascals-triangle/test/Tests.hs +0 -2
  112. data/tracks/haskell/exercises/phone-number/package.yaml +1 -0
  113. data/tracks/haskell/exercises/phone-number/test/Tests.hs +0 -2
  114. data/tracks/haskell/exercises/pig-latin/package.yaml +1 -0
  115. data/tracks/haskell/exercises/pig-latin/test/Tests.hs +0 -2
  116. data/tracks/haskell/exercises/pov/package.yaml +1 -0
  117. data/tracks/haskell/exercises/pov/test/Tests.hs +0 -2
  118. data/tracks/haskell/exercises/prime-factors/package.yaml +1 -0
  119. data/tracks/haskell/exercises/prime-factors/test/Tests.hs +0 -2
  120. data/tracks/haskell/exercises/pythagorean-triplet/package.yaml +1 -0
  121. data/tracks/haskell/exercises/pythagorean-triplet/test/Tests.hs +0 -3
  122. data/tracks/haskell/exercises/queen-attack/package.yaml +1 -0
  123. data/tracks/haskell/exercises/queen-attack/test/Tests.hs +0 -2
  124. data/tracks/haskell/exercises/raindrops/package.yaml +1 -0
  125. data/tracks/haskell/exercises/raindrops/test/Tests.hs +0 -2
  126. data/tracks/haskell/exercises/rna-transcription/package.yaml +1 -0
  127. data/tracks/haskell/exercises/rna-transcription/test/Tests.hs +0 -2
  128. data/tracks/haskell/exercises/robot-name/package.yaml +1 -0
  129. data/tracks/haskell/exercises/robot-name/test/Tests.hs +0 -3
  130. data/tracks/haskell/exercises/robot-simulator/package.yaml +1 -0
  131. data/tracks/haskell/exercises/robot-simulator/test/Tests.hs +0 -3
  132. data/tracks/haskell/exercises/roman-numerals/package.yaml +1 -0
  133. data/tracks/haskell/exercises/roman-numerals/test/Tests.hs +0 -2
  134. data/tracks/haskell/exercises/run-length-encoding/package.yaml +1 -0
  135. data/tracks/haskell/exercises/run-length-encoding/test/Tests.hs +0 -4
  136. data/tracks/haskell/exercises/saddle-points/package.yaml +1 -0
  137. data/tracks/haskell/exercises/saddle-points/test/Tests.hs +0 -3
  138. data/tracks/haskell/exercises/say/package.yaml +1 -0
  139. data/tracks/haskell/exercises/say/test/Tests.hs +0 -2
  140. data/tracks/haskell/exercises/scrabble-score/package.yaml +1 -0
  141. data/tracks/haskell/exercises/scrabble-score/test/Tests.hs +0 -2
  142. data/tracks/haskell/exercises/secret-handshake/package.yaml +1 -0
  143. data/tracks/haskell/exercises/secret-handshake/test/Tests.hs +0 -2
  144. data/tracks/haskell/exercises/series/package.yaml +1 -0
  145. data/tracks/haskell/exercises/series/test/Tests.hs +0 -3
  146. data/tracks/haskell/exercises/sgf-parsing/package.yaml +1 -0
  147. data/tracks/haskell/exercises/sgf-parsing/test/Tests.hs +0 -3
  148. data/tracks/haskell/exercises/sieve/package.yaml +1 -0
  149. data/tracks/haskell/exercises/sieve/test/Tests.hs +0 -2
  150. data/tracks/haskell/exercises/simple-cipher/package.yaml +1 -0
  151. data/tracks/haskell/exercises/simple-cipher/test/Tests.hs +0 -3
  152. data/tracks/haskell/exercises/simple-linked-list/package.yaml +1 -0
  153. data/tracks/haskell/exercises/simple-linked-list/test/Tests.hs +0 -3
  154. data/tracks/haskell/exercises/space-age/package.yaml +1 -0
  155. data/tracks/haskell/exercises/space-age/test/Tests.hs +0 -2
  156. data/tracks/haskell/exercises/strain/package.yaml +1 -0
  157. data/tracks/haskell/exercises/strain/test/Tests.hs +0 -3
  158. data/tracks/haskell/exercises/sublist/package.yaml +1 -0
  159. data/tracks/haskell/exercises/sublist/test/Tests.hs +0 -2
  160. data/tracks/haskell/exercises/sum-of-multiples/package.yaml +1 -0
  161. data/tracks/haskell/exercises/sum-of-multiples/test/Tests.hs +0 -2
  162. data/tracks/haskell/exercises/triangle/package.yaml +1 -0
  163. data/tracks/haskell/exercises/triangle/test/Tests.hs +0 -3
  164. data/tracks/haskell/exercises/trinary/package.yaml +1 -0
  165. data/tracks/haskell/exercises/trinary/test/Tests.hs +0 -3
  166. data/tracks/haskell/exercises/word-count/package.yaml +1 -0
  167. data/tracks/haskell/exercises/word-count/test/Tests.hs +0 -2
  168. data/tracks/haskell/exercises/wordy/package.yaml +1 -0
  169. data/tracks/haskell/exercises/wordy/test/Tests.hs +0 -2
  170. data/tracks/haskell/exercises/zebra-puzzle/package.yaml +1 -0
  171. data/tracks/haskell/exercises/zipper/package.yaml +1 -0
  172. data/tracks/haskell/exercises/zipper/test/Tests.hs +0 -3
  173. data/tracks/java/exercises/book-store/src/test/java/BookstoreTest.java +12 -12
  174. data/tracks/java/exercises/ocr-numbers/src/test/java/OpticalCharacterReaderTest.java +16 -16
  175. data/tracks/java/exercises/strain/src/test/java/StrainTest.java +11 -11
  176. data/tracks/perl6/README.md +12 -0
  177. data/tracks/perl6/bin/README.md +3 -0
  178. data/tracks/perl6/config.json +20 -20
  179. data/tracks/perl6/exercises/accumulate/{Example.pm → Example.pm6} +0 -0
  180. data/tracks/perl6/exercises/all-your-base/{Example.pm → Example.pm6} +0 -0
  181. data/tracks/perl6/exercises/allergies/{Example.pm → Example.pm6} +0 -0
  182. data/tracks/perl6/exercises/anagram/{Example.pm → Example.pm6} +0 -0
  183. data/tracks/perl6/exercises/atbash-cipher/{Example.pm → Example.pm6} +0 -0
  184. data/tracks/perl6/exercises/binary/{Example.pm → Example.pm6} +0 -0
  185. data/tracks/perl6/exercises/bob/{Example.pm → Example.pm6} +0 -0
  186. data/tracks/perl6/exercises/bob/bob.t +181 -180
  187. data/tracks/perl6/exercises/bob/example.yaml +1 -0
  188. data/tracks/perl6/exercises/grade-school/{Example.pm → Example.pm6} +0 -0
  189. data/tracks/perl6/exercises/grade-school/grade-school.t +9 -18
  190. data/tracks/perl6/exercises/grains/{Example.pm → Example.pm6} +0 -0
  191. data/tracks/perl6/exercises/hello-world/{Example.pm → Example.pm6} +0 -0
  192. data/tracks/perl6/exercises/hello-world/example.yaml +1 -0
  193. data/tracks/perl6/exercises/hello-world/hello-world.t +38 -43
  194. data/tracks/perl6/exercises/leap/{Example.pm → Example.pm6} +0 -0
  195. data/tracks/perl6/exercises/leap/leap.t +40 -42
  196. data/tracks/perl6/exercises/phone-number/{Example.pm → Example.pm6} +2 -2
  197. data/tracks/perl6/exercises/phone-number/PhoneNumber.pm6 +1 -1
  198. data/tracks/perl6/exercises/phone-number/example.yaml +2 -2
  199. data/tracks/perl6/exercises/phone-number/phone-number.t +3 -9
  200. data/tracks/perl6/exercises/raindrops/{Example.pm → Example.pm6} +0 -0
  201. data/tracks/perl6/exercises/rna-transcription/{Example.pm → Example.pm6} +0 -0
  202. data/tracks/perl6/exercises/robot-name/{Example.pm → Example.pm6} +0 -0
  203. data/tracks/perl6/exercises/scrabble-score/{Example.pm → Example.pm6} +0 -0
  204. data/tracks/perl6/exercises/space-age/{Example.pm → Example.pm6} +0 -0
  205. data/tracks/perl6/exercises/trinary/{Example.pm → Example.pm6} +0 -0
  206. data/tracks/perl6/exercises/word-count/{Example.pm → Example.pm6} +0 -0
  207. data/tracks/perl6/exercises/wordy/{Example.pm → Example.pm6} +0 -0
  208. data/tracks/python/.github/stale.yml +4 -4
  209. data/tracks/python/config.json +24 -0
  210. data/tracks/python/exercises/alphametics/alphametics.py +2 -0
  211. data/tracks/python/exercises/alphametics/alphametics_test.py +71 -0
  212. data/tracks/python/exercises/alphametics/example.py +29 -0
  213. data/tracks/python/exercises/book-store/book_store.py +2 -0
  214. data/tracks/python/exercises/book-store/book_store_test.py +72 -0
  215. data/tracks/python/exercises/book-store/example.py +29 -0
  216. data/tracks/python/exercises/meetup/meetup_test.py +341 -1
  217. data/tracks/python/exercises/tournament/example.py +45 -0
  218. data/tracks/python/exercises/tournament/tournament.py +2 -0
  219. data/tracks/python/exercises/tournament/tournament_test.py +70 -0
  220. data/tracks/python/exercises/variable-length-quantity/example.py +34 -0
  221. data/tracks/python/exercises/variable-length-quantity/variable_length_quantity.py +6 -0
  222. data/tracks/python/exercises/variable-length-quantity/variable_length_quantity_test.py +100 -0
  223. data/tracks/r/config.json +23 -23
  224. data/tracks/r/exercises/perfect-numbers/test_perfect-numbers.R +1 -1
  225. data/tracks/r/exercises/prime-factors/test_prime-factors.R +2 -0
  226. data/tracks/r/exercises/tournament/example.R +2 -5
  227. data/tracks/scala/exercises/leap/example.scala +4 -4
  228. data/tracks/scala/exercises/leap/src/main/scala/Leap.scala +3 -0
  229. data/tracks/scala/exercises/leap/src/test/scala/LeapTest.scala +6 -6
  230. metadata +43 -22
@@ -1,4 +1,5 @@
1
1
  import unittest
2
+
2
3
  from datetime import date
3
4
 
4
5
  from meetup import meetup_day
@@ -9,35 +10,373 @@ except ImportError:
9
10
  MeetupDayException = Exception
10
11
 
11
12
 
13
+ # test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
14
+
12
15
  class MeetupTest(unittest.TestCase):
13
16
  def test_monteenth_of_may_2013(self):
14
17
  self.assertEqual(
15
18
  meetup_day(2013, 5, 'Monday', 'teenth'), date(2013, 5, 13))
16
19
 
20
+ def test_monteenth_of_august_2013(self):
21
+ self.assertEqual(
22
+ meetup_day(2013, 8, 'Monday', 'teenth'), date(2013, 8, 19))
23
+
24
+ def test_monteenth_of_september_2013(self):
25
+ self.assertEqual(
26
+ meetup_day(2013, 9, 'Monday', 'teenth'), date(2013, 9, 16))
27
+
28
+ def test_tuesteenth_of_march_2013(self):
29
+ self.assertEqual(
30
+ meetup_day(2013, 3, 'Tuesday', 'teenth'), date(2013, 3, 19))
31
+
32
+ def test_tuesteenth_of_april_2013(self):
33
+ self.assertEqual(
34
+ meetup_day(2013, 4, 'Tuesday', 'teenth'), date(2013, 4, 16))
35
+
36
+ def test_tuesteenth_of_august_2013(self):
37
+ self.assertEqual(
38
+ meetup_day(2013, 8, 'Tuesday', 'teenth'), date(2013, 8, 13))
39
+
40
+ def test_wednesteenth_of_january_2013(self):
41
+ self.assertEqual(
42
+ meetup_day(2013, 1, 'Wednesday', 'teenth'), date(2013, 1, 16))
43
+
44
+ def test_wednesteenth_of_february_2013(self):
45
+ self.assertEqual(
46
+ meetup_day(2013, 2, 'Wednesday', 'teenth'), date(2013, 2, 13))
47
+
48
+ def test_wednesteenth_of_june_2013(self):
49
+ self.assertEqual(
50
+ meetup_day(2013, 6, 'Wednesday', 'teenth'), date(2013, 6, 19))
51
+
52
+ def test_thursteenth_of_may_2013(self):
53
+ self.assertEqual(
54
+ meetup_day(2013, 5, 'Thursday', 'teenth'), date(2013, 5, 16))
55
+
56
+ def test_thursteenth_of_june_2013(self):
57
+ self.assertEqual(
58
+ meetup_day(2013, 6, 'Thursday', 'teenth'), date(2013, 6, 13))
59
+
60
+ def test_thursteenth_of_september_2013(self):
61
+ self.assertEqual(
62
+ meetup_day(2013, 9, 'Thursday', 'teenth'), date(2013, 9, 19))
63
+
64
+ def test_friteenth_of_april_2013(self):
65
+ self.assertEqual(
66
+ meetup_day(2013, 4, 'Friday', 'teenth'), date(2013, 4, 19))
67
+
68
+ def test_friteenth_of_august_2013(self):
69
+ self.assertEqual(
70
+ meetup_day(2013, 8, 'Friday', 'teenth'), date(2013, 8, 16))
71
+
72
+ def test_friteenth_of_september_2013(self):
73
+ self.assertEqual(
74
+ meetup_day(2013, 9, 'Friday', 'teenth'), date(2013, 9, 13))
75
+
17
76
  def test_saturteenth_of_february_2013(self):
18
77
  self.assertEqual(
19
78
  meetup_day(2013, 2, 'Saturday', 'teenth'), date(2013, 2, 16))
20
79
 
80
+ def test_saturteenth_of_april_2013(self):
81
+ self.assertEqual(
82
+ meetup_day(2013, 4, 'Saturday', 'teenth'), date(2013, 4, 13))
83
+
84
+ def test_saturteenth_of_october_2013(self):
85
+ self.assertEqual(
86
+ meetup_day(2013, 10, 'Saturday', 'teenth'), date(2013, 10, 19))
87
+
88
+ def test_sunteenth_of_may_2013(self):
89
+ self.assertEqual(
90
+ meetup_day(2013, 5, 'Sunday', 'teenth'), date(2013, 5, 19))
91
+
92
+ def test_sunteenth_of_june_2013(self):
93
+ self.assertEqual(
94
+ meetup_day(2013, 6, 'Sunday', 'teenth'), date(2013, 6, 16))
95
+
96
+ def test_sunteenth_of_october_2013(self):
97
+ self.assertEqual(
98
+ meetup_day(2013, 10, 'Sunday', 'teenth'), date(2013, 10, 13))
99
+
100
+ def test_first_monday_of_march_2013(self):
101
+ self.assertEqual(
102
+ meetup_day(2013, 3, 'Monday', '1st'), date(2013, 3, 4))
103
+
104
+ def test_first_monday_of_april_2013(self):
105
+ self.assertEqual(
106
+ meetup_day(2013, 4, 'Monday', '1st'), date(2013, 4, 1))
107
+
21
108
  def test_first_tuesday_of_may_2013(self):
22
109
  self.assertEqual(
23
110
  meetup_day(2013, 5, 'Tuesday', '1st'), date(2013, 5, 7))
24
111
 
112
+ def test_first_tuesday_of_june_2013(self):
113
+ self.assertEqual(
114
+ meetup_day(2013, 6, 'Tuesday', '1st'), date(2013, 6, 4))
115
+
116
+ def test_first_wednesday_of_july_2013(self):
117
+ self.assertEqual(
118
+ meetup_day(2013, 7, 'Wednesday', '1st'), date(2013, 7, 3))
119
+
120
+ def test_first_wednesday_of_august_2013(self):
121
+ self.assertEqual(
122
+ meetup_day(2013, 8, 'Wednesday', '1st'), date(2013, 8, 7))
123
+
124
+ def test_first_thursday_of_september_2013(self):
125
+ self.assertEqual(
126
+ meetup_day(2013, 9, 'Thursday', '1st'), date(2013, 9, 5))
127
+
128
+ def test_first_thursday_of_october_2013(self):
129
+ self.assertEqual(
130
+ meetup_day(2013, 10, 'Thursday', '1st'), date(2013, 10, 3))
131
+
132
+ def test_first_friday_of_november_2013(self):
133
+ self.assertEqual(
134
+ meetup_day(2013, 11, 'Friday', '1st'), date(2013, 11, 1))
135
+
136
+ def test_first_friday_of_december_2013(self):
137
+ self.assertEqual(
138
+ meetup_day(2013, 12, 'Friday', '1st'), date(2013, 12, 6))
139
+
140
+ def test_first_saturday_of_january_2013(self):
141
+ self.assertEqual(
142
+ meetup_day(2013, 1, 'Saturday', '1st'), date(2013, 1, 5))
143
+
144
+ def test_first_saturday_of_february_2013(self):
145
+ self.assertEqual(
146
+ meetup_day(2013, 2, 'Saturday', '1st'), date(2013, 2, 2))
147
+
148
+ def test_first_sunday_of_march_2013(self):
149
+ self.assertEqual(
150
+ meetup_day(2013, 3, 'Sunday', '1st'), date(2013, 3, 3))
151
+
152
+ def test_first_sunday_of_april_2013(self):
153
+ self.assertEqual(
154
+ meetup_day(2013, 4, 'Sunday', '1st'), date(2013, 4, 7))
155
+
156
+ def test_second_monday_of_march_2013(self):
157
+ self.assertEqual(
158
+ meetup_day(2013, 3, 'Monday', '2nd'), date(2013, 3, 11))
159
+
25
160
  def test_second_monday_of_april_2013(self):
26
161
  self.assertEqual(
27
162
  meetup_day(2013, 4, 'Monday', '2nd'), date(2013, 4, 8))
28
163
 
164
+ def test_second_tuesday_of_may_2013(self):
165
+ self.assertEqual(
166
+ meetup_day(2013, 5, 'Tuesday', '2nd'), date(2013, 5, 14))
167
+
168
+ def test_second_tuesday_of_june_2013(self):
169
+ self.assertEqual(
170
+ meetup_day(2013, 6, 'Tuesday', '2nd'), date(2013, 6, 11))
171
+
172
+ def test_second_wednesday_of_july_2013(self):
173
+ self.assertEqual(
174
+ meetup_day(2013, 7, 'Wednesday', '2nd'), date(2013, 7, 10))
175
+
176
+ def test_second_wednesday_of_august_2013(self):
177
+ self.assertEqual(
178
+ meetup_day(2013, 8, 'Wednesday', '2nd'), date(2013, 8, 14))
179
+
180
+ def test_second_thursday_of_september_2013(self):
181
+ self.assertEqual(
182
+ meetup_day(2013, 9, 'Thursday', '2nd'), date(2013, 9, 12))
183
+
184
+ def test_second_thursday_of_october_2013(self):
185
+ self.assertEqual(
186
+ meetup_day(2013, 10, 'Thursday', '2nd'), date(2013, 10, 10))
187
+
188
+ def test_second_friday_of_november_2013(self):
189
+ self.assertEqual(
190
+ meetup_day(2013, 11, 'Friday', '2nd'), date(2013, 11, 8))
191
+
192
+ def test_second_friday_of_december_2013(self):
193
+ self.assertEqual(
194
+ meetup_day(2013, 12, 'Friday', '2nd'), date(2013, 12, 13))
195
+
196
+ def test_second_saturday_of_january_2013(self):
197
+ self.assertEqual(
198
+ meetup_day(2013, 1, 'Saturday', '2nd'), date(2013, 1, 12))
199
+
200
+ def test_second_saturday_of_february_2013(self):
201
+ self.assertEqual(
202
+ meetup_day(2013, 2, 'Saturday', '2nd'), date(2013, 2, 9))
203
+
204
+ def test_second_sunday_of_march_2013(self):
205
+ self.assertEqual(
206
+ meetup_day(2013, 3, 'Sunday', '2nd'), date(2013, 3, 10))
207
+
208
+ def test_second_sunday_of_april_2013(self):
209
+ self.assertEqual(
210
+ meetup_day(2013, 4, 'Sunday', '2nd'), date(2013, 4, 14))
211
+
212
+ def test_third_monday_of_march_2013(self):
213
+ self.assertEqual(
214
+ meetup_day(2013, 3, 'Monday', '3rd'), date(2013, 3, 18))
215
+
216
+ def test_third_monday_of_april_2013(self):
217
+ self.assertEqual(
218
+ meetup_day(2013, 4, 'Monday', '3rd'), date(2013, 4, 15))
219
+
220
+ def test_third_tuesday_of_may_2013(self):
221
+ self.assertEqual(
222
+ meetup_day(2013, 5, 'Tuesday', '3rd'), date(2013, 5, 21))
223
+
224
+ def test_third_tuesday_of_june_2013(self):
225
+ self.assertEqual(
226
+ meetup_day(2013, 6, 'Tuesday', '3rd'), date(2013, 6, 18))
227
+
228
+ def test_third_wednesday_of_july_2013(self):
229
+ self.assertEqual(
230
+ meetup_day(2013, 7, 'Wednesday', '3rd'), date(2013, 7, 17))
231
+
232
+ def test_third_wednesday_of_august_2013(self):
233
+ self.assertEqual(
234
+ meetup_day(2013, 8, 'Wednesday', '3rd'), date(2013, 8, 21))
235
+
29
236
  def test_third_thursday_of_september_2013(self):
30
237
  self.assertEqual(
31
238
  meetup_day(2013, 9, 'Thursday', '3rd'), date(2013, 9, 19))
32
239
 
240
+ def test_third_thursday_of_october_2013(self):
241
+ self.assertEqual(
242
+ meetup_day(2013, 10, 'Thursday', '3rd'), date(2013, 10, 17))
243
+
244
+ def test_third_friday_of_november_2013(self):
245
+ self.assertEqual(
246
+ meetup_day(2013, 11, 'Friday', '3rd'), date(2013, 11, 15))
247
+
248
+ def test_third_friday_of_december_2013(self):
249
+ self.assertEqual(
250
+ meetup_day(2013, 12, 'Friday', '3rd'), date(2013, 12, 20))
251
+
252
+ def test_third_saturday_of_january_2013(self):
253
+ self.assertEqual(
254
+ meetup_day(2013, 1, 'Saturday', '3rd'), date(2013, 1, 19))
255
+
256
+ def test_third_saturday_of_february_2013(self):
257
+ self.assertEqual(
258
+ meetup_day(2013, 2, 'Saturday', '3rd'), date(2013, 2, 16))
259
+
260
+ def test_third_sunday_of_march_2013(self):
261
+ self.assertEqual(
262
+ meetup_day(2013, 3, 'Sunday', '3rd'), date(2013, 3, 17))
263
+
264
+ def test_third_sunday_of_april_2013(self):
265
+ self.assertEqual(
266
+ meetup_day(2013, 4, 'Sunday', '3rd'), date(2013, 4, 21))
267
+
268
+ def test_fourth_monday_of_march_2013(self):
269
+ self.assertEqual(
270
+ meetup_day(2013, 3, 'Monday', '4th'), date(2013, 3, 25))
271
+
272
+ def test_fourth_monday_of_april_2013(self):
273
+ self.assertEqual(
274
+ meetup_day(2013, 4, 'Monday', '4th'), date(2013, 4, 22))
275
+
276
+ def test_fourth_tuesday_of_may_2013(self):
277
+ self.assertEqual(
278
+ meetup_day(2013, 5, 'Tuesday', '4th'), date(2013, 5, 28))
279
+
280
+ def test_fourth_tuesday_of_june_2013(self):
281
+ self.assertEqual(
282
+ meetup_day(2013, 6, 'Tuesday', '4th'), date(2013, 6, 25))
283
+
284
+ def test_fourth_wednesday_of_july_2013(self):
285
+ self.assertEqual(
286
+ meetup_day(2013, 7, 'Wednesday', '4th'), date(2013, 7, 24))
287
+
288
+ def test_fourth_wednesday_of_august_2013(self):
289
+ self.assertEqual(
290
+ meetup_day(2013, 8, 'Wednesday', '4th'), date(2013, 8, 28))
291
+
292
+ def test_fourth_thursday_of_september_2013(self):
293
+ self.assertEqual(
294
+ meetup_day(2013, 9, 'Thursday', '4th'), date(2013, 9, 26))
295
+
296
+ def test_fourth_thursday_of_october_2013(self):
297
+ self.assertEqual(
298
+ meetup_day(2013, 10, 'Thursday', '4th'), date(2013, 10, 24))
299
+
300
+ def test_fourth_friday_of_november_2013(self):
301
+ self.assertEqual(
302
+ meetup_day(2013, 11, 'Friday', '4th'), date(2013, 11, 22))
303
+
304
+ def test_fourth_friday_of_december_2013(self):
305
+ self.assertEqual(
306
+ meetup_day(2013, 12, 'Friday', '4th'), date(2013, 12, 27))
307
+
308
+ def test_fourth_saturday_of_january_2013(self):
309
+ self.assertEqual(
310
+ meetup_day(2013, 1, 'Saturday', '4th'), date(2013, 1, 26))
311
+
312
+ def test_fourth_saturday_of_february_2013(self):
313
+ self.assertEqual(
314
+ meetup_day(2013, 2, 'Saturday', '4th'), date(2013, 2, 23))
315
+
33
316
  def test_fourth_sunday_of_march_2013(self):
34
317
  self.assertEqual(
35
318
  meetup_day(2013, 3, 'Sunday', '4th'), date(2013, 3, 24))
36
319
 
320
+ def test_fourth_sunday_of_april_2013(self):
321
+ self.assertEqual(
322
+ meetup_day(2013, 4, 'Sunday', '4th'), date(2013, 4, 28))
323
+
324
+ def test_last_monday_of_march_2013(self):
325
+ self.assertEqual(
326
+ meetup_day(2013, 3, 'Monday', 'last'), date(2013, 3, 25))
327
+
328
+ def test_last_monday_of_april_2013(self):
329
+ self.assertEqual(
330
+ meetup_day(2013, 4, 'Monday', 'last'), date(2013, 4, 29))
331
+
332
+ def test_last_tuesday_of_may_2013(self):
333
+ self.assertEqual(
334
+ meetup_day(2013, 5, 'Tuesday', 'last'), date(2013, 5, 28))
335
+
336
+ def test_last_tuesday_of_june_2013(self):
337
+ self.assertEqual(
338
+ meetup_day(2013, 6, 'Tuesday', 'last'), date(2013, 6, 25))
339
+
340
+ def test_last_wednesday_of_july_2013(self):
341
+ self.assertEqual(
342
+ meetup_day(2013, 7, 'Wednesday', 'last'), date(2013, 7, 31))
343
+
344
+ def test_last_wednesday_of_august_2013(self):
345
+ self.assertEqual(
346
+ meetup_day(2013, 8, 'Wednesday', 'last'), date(2013, 8, 28))
347
+
348
+ def test_last_thursday_of_september_2013(self):
349
+ self.assertEqual(
350
+ meetup_day(2013, 9, 'Thursday', 'last'), date(2013, 9, 26))
351
+
37
352
  def test_last_thursday_of_october_2013(self):
38
353
  self.assertEqual(
39
354
  meetup_day(2013, 10, 'Thursday', 'last'), date(2013, 10, 31))
40
355
 
356
+ def test_last_friday_of_november_2013(self):
357
+ self.assertEqual(
358
+ meetup_day(2013, 11, 'Friday', 'last'), date(2013, 11, 29))
359
+
360
+ def test_last_friday_of_december_2013(self):
361
+ self.assertEqual(
362
+ meetup_day(2013, 12, 'Friday', 'last'), date(2013, 12, 27))
363
+
364
+ def test_last_saturday_of_january_2013(self):
365
+ self.assertEqual(
366
+ meetup_day(2013, 1, 'Saturday', 'last'), date(2013, 1, 26))
367
+
368
+ def test_last_saturday_of_february_2013(self):
369
+ self.assertEqual(
370
+ meetup_day(2013, 2, 'Saturday', 'last'), date(2013, 2, 23))
371
+
372
+ def test_last_sunday_of_march_2013(self):
373
+ self.assertEqual(
374
+ meetup_day(2013, 3, 'Sunday', 'last'), date(2013, 3, 31))
375
+
376
+ def test_last_sunday_of_april_2013(self):
377
+ self.assertEqual(
378
+ meetup_day(2013, 4, 'Sunday', 'last'), date(2013, 4, 28))
379
+
41
380
  def test_last_wednesday_of_february_2012(self):
42
381
  self.assertEqual(
43
382
  meetup_day(2012, 2, 'Wednesday', 'last'), date(2012, 2, 29))
@@ -46,7 +385,7 @@ class MeetupTest(unittest.TestCase):
46
385
  self.assertEqual(
47
386
  meetup_day(2014, 12, 'Wednesday', 'last'), date(2014, 12, 31))
48
387
 
49
- def test_last_sunday_of_only_four_week_february_2015(self):
388
+ def test_last_sunday_of_february_2015(self):
50
389
  self.assertEqual(
51
390
  meetup_day(2015, 2, 'Sunday', 'last'), date(2015, 2, 22))
52
391
 
@@ -54,6 +393,7 @@ class MeetupTest(unittest.TestCase):
54
393
  self.assertEqual(
55
394
  meetup_day(2012, 12, 'Friday', '1st'), date(2012, 12, 7))
56
395
 
396
+ # additional track specific tests
57
397
  def test_fifth_monday_of_march_2015(self):
58
398
  self.assertEqual(
59
399
  meetup_day(2015, 3, 'Monday', '5th'), date(2015, 3, 30))
@@ -0,0 +1,45 @@
1
+ from collections import defaultdict
2
+
3
+ RESULTS = dict(win=0, draw=1, loss=2)
4
+
5
+
6
+ def invert_result(result):
7
+ if result == 0:
8
+ return 2
9
+ elif result == 2:
10
+ return 0
11
+ return result
12
+
13
+
14
+ def parse_game(game_line):
15
+ game = game_line.split(';')
16
+ if len(game) == 3 and game[2] in RESULTS:
17
+ result = RESULTS[game[2]]
18
+ return (game[0], result), (game[1], invert_result(result))
19
+ return []
20
+
21
+
22
+ def calculate_points(stats):
23
+ return stats[0] * 3 + stats[1]
24
+
25
+
26
+ def format_table(results):
27
+ table = ['Team | MP | W | D | L | P']
28
+
29
+ for team, games in sorted(
30
+ results.items(), key=lambda g: (-calculate_points(g[1]), g[0])):
31
+ team_fmt = '{0:30} | {1:2} | {3:2} | {4:2} | {5:2} | {2:2}'
32
+ table.append(
33
+ team_fmt.format(team, sum(games), calculate_points(games), *games))
34
+
35
+ return '\n'.join(table)
36
+
37
+
38
+ def tally(data):
39
+ table = defaultdict(lambda: [0, 0, 0])
40
+
41
+ for line in data.split('\n'):
42
+ for team, result in parse_game(line):
43
+ table[team][result] += 1
44
+
45
+ return format_table(table)
@@ -0,0 +1,2 @@
1
+ def tally(data):
2
+ pass
@@ -0,0 +1,70 @@
1
+ import unittest
2
+
3
+ from tournament import tally
4
+
5
+
6
+ # test cases adapted from `x-common//canonical-data.json` @ version: 1.1.0
7
+
8
+ class TestTournament(unittest.TestCase):
9
+ def test_typical_input(self):
10
+ results = ('Allegoric Alaskans;Blithering Badgers;win\n'
11
+ 'Devastating Donkeys;Courageous Californians;draw\n'
12
+ 'Devastating Donkeys;Allegoric Alaskans;win\n'
13
+ 'Courageous Californians;Blithering Badgers;loss\n'
14
+ 'Blithering Badgers;Devastating Donkeys;loss\n'
15
+ 'Allegoric Alaskans;Courageous Californians;win')
16
+
17
+ table = ('Team | MP | W | D | L | P\n'
18
+ 'Devastating Donkeys | 3 | 2 | 1 | 0 | 7\n'
19
+ 'Allegoric Alaskans | 3 | 2 | 0 | 1 | 6\n'
20
+ 'Blithering Badgers | 3 | 1 | 0 | 2 | 3\n'
21
+ 'Courageous Californians | 3 | 0 | 1 | 2 | 1')
22
+
23
+ self.assertEqual(tally(results), table)
24
+
25
+ def test_incomplete_competitionnot_all_pairs_have_played(self):
26
+ results = ('Allegoric Alaskans;Blithering Badgers;loss\n'
27
+ 'Devastating Donkeys;Allegoric Alaskans;loss\n'
28
+ 'Courageous Californians;Blithering Badgers;draw\n'
29
+ 'Allegoric Alaskans;Courageous Californians;win')
30
+
31
+ table = ('Team | MP | W | D | L | P\n'
32
+ 'Allegoric Alaskans | 3 | 2 | 0 | 1 | 6\n'
33
+ 'Blithering Badgers | 2 | 1 | 1 | 0 | 4\n'
34
+ 'Courageous Californians | 2 | 0 | 1 | 1 | 1\n'
35
+ 'Devastating Donkeys | 1 | 0 | 0 | 1 | 0')
36
+
37
+ self.assertEqual(tally(results), table)
38
+
39
+ def test_ties_broken_alphabetically(self):
40
+ results = ('Courageous Californians;Devastating Donkeys;win\n'
41
+ 'Allegoric Alaskans;Blithering Badgers;win\n'
42
+ 'Devastating Donkeys;Allegoric Alaskans;loss\n'
43
+ 'Courageous Californians;Blithering Badgers;win\n'
44
+ 'Blithering Badgers;Devastating Donkeys;draw\n'
45
+ 'Allegoric Alaskans;Courageous Californians;draw')
46
+
47
+ table = ('Team | MP | W | D | L | P\n'
48
+ 'Allegoric Alaskans | 3 | 2 | 1 | 0 | 7\n'
49
+ 'Courageous Californians | 3 | 2 | 1 | 0 | 7\n'
50
+ 'Blithering Badgers | 3 | 0 | 1 | 2 | 1\n'
51
+ 'Devastating Donkeys | 3 | 0 | 1 | 2 | 1')
52
+
53
+ self.assertEqual(tally(results), table)
54
+
55
+ def test_mostly_invalid_lines(self):
56
+ results = ('\n'
57
+ 'Allegoric Alaskans@Blithering Badgers;draw\n'
58
+ 'Blithering Badgers;Devastating Donkeys;loss\n'
59
+ 'Devastating Donkeys;Courageous Californians;win;5\n'
60
+ 'Courageous Californians;Allegoric Alaskans;los')
61
+
62
+ table = ('Team | MP | W | D | L | P\n'
63
+ 'Devastating Donkeys | 1 | 1 | 0 | 0 | 3\n'
64
+ 'Blithering Badgers | 1 | 0 | 0 | 1 | 0')
65
+
66
+ self.assertEqual(tally(results), table)
67
+
68
+
69
+ if __name__ == '__main__':
70
+ unittest.main()
@@ -0,0 +1,34 @@
1
+ EIGHTBITMASK = 0x80
2
+ SEVENBITSMASK = 0x7f
3
+
4
+
5
+ def encode_single(n):
6
+ bytes = [n & SEVENBITSMASK]
7
+ n >>= 7
8
+
9
+ while n > 0:
10
+ bytes.append(n & SEVENBITSMASK | EIGHTBITMASK)
11
+ n >>= 7
12
+
13
+ return bytes[::-1]
14
+
15
+
16
+ def encode(numbers):
17
+ return sum((encode_single(n) for n in numbers), [])
18
+
19
+
20
+ def decode(bytes):
21
+ values = []
22
+ n = 0
23
+
24
+ for i, byte in enumerate(bytes):
25
+ n <<= 7
26
+ n += (byte & SEVENBITSMASK)
27
+
28
+ if byte & EIGHTBITMASK == 0:
29
+ values.append(n)
30
+ n = 0
31
+ elif i == len(bytes) - 1:
32
+ raise ValueError('incomplete byte sequence')
33
+
34
+ return values
@@ -0,0 +1,6 @@
1
+ def encode():
2
+ pass
3
+
4
+
5
+ def decode():
6
+ pass
@@ -0,0 +1,100 @@
1
+ import unittest
2
+
3
+ from variable_length_quantity import encode, decode
4
+
5
+
6
+ # test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
7
+
8
+ class TestVLQ(unittest.TestCase):
9
+ def test_zero(self):
10
+ self.assertEqual(encode([0x0]), [0x0])
11
+
12
+ def test_arbitrary_single_byte(self):
13
+ self.assertEqual(encode([0x40]), [0x40])
14
+
15
+ def test_largest_single_byte(self):
16
+ self.assertEqual(encode([0x7f]), [0x7f])
17
+
18
+ def test_smallest_double_byte(self):
19
+ self.assertEqual(encode([0x80]), [0x81, 0x0])
20
+
21
+ def test_arbitrary_double_byte(self):
22
+ self.assertEqual(encode([0x2000]), [0xc0, 0x0])
23
+
24
+ def test_largest_double_byte(self):
25
+ self.assertEqual(encode([0x3fff]), [0xff, 0x7f])
26
+
27
+ def test_smallest_triple_byte(self):
28
+ self.assertEqual(encode([0x4000]), [0x81, 0x80, 0x0])
29
+
30
+ def test_arbitrary_triple_byte(self):
31
+ self.assertEqual(encode([0x100000]), [0xc0, 0x80, 0x0])
32
+
33
+ def test_largest_triple_byte(self):
34
+ self.assertEqual(encode([0x1fffff]), [0xff, 0xff, 0x7f])
35
+
36
+ def test_smallest_quadruple_byte(self):
37
+ self.assertEqual(encode([0x200000]), [0x81, 0x80, 0x80, 0x0])
38
+
39
+ def test_arbitrary_quadruple_byte(self):
40
+ self.assertEqual(encode([0x8000000]), [0xc0, 0x80, 0x80, 0x0])
41
+
42
+ def test_largest_quadruple_byte(self):
43
+ self.assertEqual(encode([0xfffffff]), [0xff, 0xff, 0xff, 0x7f])
44
+
45
+ def test_smallest_quintuple_byte(self):
46
+ self.assertEqual(encode([0x10000000]), [0x81, 0x80, 0x80, 0x80, 0x0])
47
+
48
+ def test_arbitrary_quintuple_byte(self):
49
+ self.assertEqual(encode([0xff000000]), [0x8f, 0xf8, 0x80, 0x80, 0x0])
50
+
51
+ def test_maximum_32_bit_integer_input(self):
52
+ self.assertEqual(encode([0xffffffff]), [0x8f, 0xff, 0xff, 0xff, 0x7f])
53
+
54
+ def test_two_single_byte_values(self):
55
+ self.assertEqual(encode([0x40, 0x7f]), [0x40, 0x7f])
56
+
57
+ def test_two_multi_byte_values(self):
58
+ self.assertEqual(
59
+ encode([0x4000, 0x123456]), [0x81, 0x80, 0x0, 0xc8, 0xe8, 0x56])
60
+
61
+ def test_many_multi_byte_values(self):
62
+ self.assertEqual(
63
+ encode([0x2000, 0x123456, 0xfffffff, 0x0, 0x3fff, 0x4000]),
64
+ [0xc0, 0x0, 0xc8, 0xe8, 0x56, 0xff, 0xff, 0xff, 0x7f, 0x0, 0xff,
65
+ 0x7f, 0x81, 0x80, 0x0]
66
+ )
67
+
68
+ def test_one_byte(self):
69
+ self.assertEqual(decode([0x7f]), [0x7f])
70
+
71
+ def test_two_bytes(self):
72
+ self.assertEqual(decode([0xc0, 0x0]), [0x2000])
73
+
74
+ def test_three_bytes(self):
75
+ self.assertEqual(decode([0xff, 0xff, 0x7f]), [0x1fffff])
76
+
77
+ def test_four_bytes(self):
78
+ self.assertEqual(decode([0x81, 0x80, 0x80, 0x0]), [0x200000])
79
+
80
+ def test_maximum_32_bit_integer(self):
81
+ self.assertEqual(decode([0x8f, 0xff, 0xff, 0xff, 0x7f]), [0xffffffff])
82
+
83
+ def test_incomplete_sequence_causes_error(self):
84
+ with self.assertRaises(ValueError):
85
+ decode([0xff])
86
+
87
+ def test_incomplete_sequence_causes_error_even_if_value_is_zero(self):
88
+ with self.assertRaises(ValueError):
89
+ decode([0x80])
90
+
91
+ def test_multiple_values(self):
92
+ self.assertEqual(
93
+ decode([0xc0, 0x0, 0xc8, 0xe8, 0x56, 0xff, 0xff, 0xff, 0x7f,
94
+ 0x0, 0xff, 0x7f, 0x81, 0x80, 0x0]),
95
+ [0x2000, 0x123456, 0xfffffff, 0x0, 0x3fff, 0x4000]
96
+ )
97
+
98
+
99
+ if __name__ == '__main__':
100
+ unittest.main()