# Copyright 2015-2017 Gregory Petukhov (lorien@lorien.name)
# *
# Licensed under the MIT License
# from __future__ import absolute_import
# import re
#
# from test_server import __version__
#
#
# def test_changelog():
#    """Check release records in chenge log.
#
#    Parse changelog and ensure that it contains
#    * unreleased version younger than release date
#    * release version has a date
#    """
#    re_date = re.compile(r'^\d{4}-\d{2}-\d{2}$')
#    re_dev_tail = re.compile(r'(a|b|c|rc|dev).*$')
#    ver_dates = {}
#    ver_history = []
#    for line in open('CHANGELOG.md'):
#        if line.startswith('## ['):
#            ver = line.split('[')[1].split(']')[0]
#            date = line.split('-', 1)[1].strip().lower()
#            ver_dates[ver] = date
#            ver_history.append(ver)
#    release = __version__
#    if any(x in release for x in ('a', 'b', 'c', 'rc', 'dev')):
#        print('Ignoring dev release: %s' % release)
#        future_stable_release = re_dev_tail.sub('', release)
#        beta_idx = ver_history.index(future_stable_release)
#        release = ver_history[beta_idx + 1]
#        print('Assuming current release is still %s' % release)
#    #print(ver_dates)
#    #print(ver_history)
#    assert 'unreleased' not in ver_dates[release]
#    assert re_date.match(ver_dates[release])
#    assert ver_history.index(release) == 1

@@ -1,144 +1,4 @@
-# Copyright 2015-2017 Gregory Petukhov (lorien@lorien.name)%0A# *%0A# Licensed under the MIT License%0A# from __future__ import absolute_import%0A# 
 impo
@@ -3,20 +3,17 @@
 port re%0A
-#%0A# 
+%0A
 from tes
@@ -44,14 +44,10 @@
 n__%0A
-#%0A#%0A# 
+%0A%0A
 def 
@@ -64,17 +64,16 @@
 elog():%0A
-#
     %22%22%22C
@@ -112,11 +112,9 @@
 og.%0A
-#%0A#
+%0A
     
@@ -157,17 +157,16 @@
 ontains%0A
-#
     * un
@@ -204,25 +204,24 @@
 elease date%0A
-#
     * releas
@@ -245,17 +245,16 @@
 ate%0A
-#
     %22%22%22%0A
 #   
@@ -249,17 +249,16 @@
     %22%22%22%0A
-#
     re_d
@@ -275,17 +275,17 @@
 ompile(r
-'
+%22
 %5E%5Cd%7B4%7D-%5C
@@ -295,20 +295,19 @@
 %7D-%5Cd%7B2%7D$
-'
+%22
 )%0A
-#
     re_d
@@ -309,20 +309,26 @@
  re_dev_
-tail
+ver_suffix
  = re.co
@@ -334,17 +334,17 @@
 ompile(r
-'
+%22
 (a%7Cb%7Cc%7Cr
@@ -356,12 +356,11 @@
 ).*$
-'
+%22
 )%0A
-#
     
@@ -374,17 +374,16 @@
 es = %7B%7D%0A
-#
     ver_
@@ -395,17 +395,16 @@
 ry = %5B%5D%0A
-#
     for 
@@ -416,17 +416,17 @@
 in open(
-'
+%22
 CHANGELO
@@ -429,21 +429,20 @@
 GELOG.md
-'
+%22
 ):%0A
-#
         
@@ -464,18 +464,17 @@
 ith(
-'
+%22
 ## %5B
-'
+%22
 ):%0A
-#
     
@@ -502,11 +502,11 @@
 lit(
-'%5B'
+%22%5B%22
 )%5B1%5D
@@ -516,17 +516,16 @@
 lit(
-'%5D'
+%22%5D%22
 )%5B0%5D%0A
-#
     
@@ -554,11 +554,11 @@
 lit(
-'-'
+%22-%22
 , 1)
@@ -577,17 +577,16 @@
 lower()%0A
-#
         
@@ -611,17 +611,16 @@
  = date%0A
-#
         
@@ -647,17 +647,16 @@
 nd(ver)%0A
-#
     rele
@@ -673,17 +673,16 @@
 rsion__%0A
-#
     if a
@@ -711,39 +711,38 @@
 in (
-'a', 'b', 'c', 'rc', 'dev'
+%22a%22, %22b%22, %22c%22, %22rc%22, %22dev%22
 )):%0A
-#
     
@@ -751,17 +751,17 @@
   print(
-'
+%22
 Ignoring
@@ -776,17 +776,17 @@
 ease: %25s
-'
+%22
  %25 relea
@@ -781,33 +781,32 @@
  %25s%22 %25 release)%0A
-#
         future_s
@@ -832,19 +832,25 @@
 dev_
-tail
+ver_suffix
 .sub(
-''
+%22%22
 , re
@@ -848,33 +848,32 @@
 ub(%22%22, release)%0A
-#
         beta_idx
@@ -912,25 +912,24 @@
 le_release)%0A
-#
         rele
@@ -960,17 +960,16 @@
 dx + 1%5D%0A
-#
         
@@ -974,17 +974,17 @@
   print(
-'
+%22
 Assuming
@@ -1011,17 +1011,17 @@
 still %25s
-'
+%22
  %25 relea
@@ -1024,22 +1024,22 @@
 elease)%0A
-#
     #
+ 
 print(ve
@@ -1051,14 +1051,14 @@
 es)%0A
-#
     #
+ 
 prin
@@ -1072,17 +1072,16 @@
 istory)%0A
-#
     asse
@@ -1083,17 +1083,17 @@
  assert 
-'
+%22
 unreleas
@@ -1098,9 +1098,9 @@
 ased
-'
+%22
  not
@@ -1122,17 +1122,16 @@
 elease%5D%0A
-#
     asse
@@ -1167,17 +1167,16 @@
 lease%5D)%0A
-#
     asse

Enable changelog test