<s> import re <EOL> from os import listdir <EOL> from os . path import join <EOL> from django . test import TestCase <EOL> from funfactory . manage import path <EOL> class MigrationTests ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> @ staticmethod <EOL> def _migrations_path ( ) : <EOL> """<STR_LIT>""" <EOL> return path ( '<STR_LIT>' ) <EOL> def test_unique ( self ) : <EOL> """<STR_LIT>""" <EOL> leading_digits = re . compile ( r'<STR_LIT>' ) <EOL> seen_numbers = set ( ) <EOL> path = self . _migrations_path ( ) <EOL> for filename in listdir ( path ) : <EOL> match = leading_digits . match ( filename ) <EOL> if match : <EOL> number = match . group ( ) <EOL> if number in seen_numbers : <EOL> self . fail ( '<STR_LIT>' % <EOL> ( number , path ) ) <EOL> seen_numbers . add ( number ) <EOL> def test_innodb_and_utf8 ( self ) : <EOL> """<STR_LIT>""" <EOL> path = self . _migrations_path ( ) <EOL> for filename in sorted ( listdir ( path ) ) : <EOL> with open ( join ( path , filename ) ) as f : <EOL> contents = f . read ( ) <EOL> creates = contents . count ( '<STR_LIT>' ) <EOL> engines = contents . count ( '<STR_LIT>' ) <EOL> encodings = ( contents . count ( '<STR_LIT>' ) + <EOL> contents . count ( '<STR_LIT>' ) ) <EOL> assert engines >= creates , ( "<STR_LIT>" <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' % filename ) <EOL> assert encodings >= creates , ( "<STR_LIT>" <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' % filename ) </s>
