import nose
from nose.tools import *
from unittest import TestCase

from os import path
from shutil import rmtree
from tempfile import mkdtemp

from stat_lines import StatLines

class StatLinesTests(TestCase):
    def test_proper_number_of_lines_are_counted_in_single_file(self):
        directory = mkdtemp("-gb-numline-tests")
        filename = path.join(directory, "2_lines.java")
        with open(filename, "w") as f:
            f.write("line1\nline2\n")
            f.close()
        stat = StatLines(directory)
        eq_(2, stat.get_stat())
        rmtree(directory)


@@ -107,16 +107,39 @@
  rmtree%0A
+from uuid import uuid4%0A
 from tem
@@ -340,14 +340,21 @@
 line
+s-single
 -test
-s
 %22)%0A 
@@ -364,153 +364,1094 @@
     
-filename = path.join(directory, %222_lines.java%22)%0A        with open(filename, %22w%22) as f:%0A            f.write(%22line1%5Cnline2%5Cn%22)%0A            f.close(
+self._create_file_with_n_lines(directory, 2)%0A        stat = StatLines(directory)%0A        eq_(2, stat.get_stat())%0A        rmtree(directory)%0A%0A    def test_proper_number_of_lines_are_counted_in_multiple_files(self):%0A        directory = mkdtemp(%22-gb-numlines-multiple-test%22)%0A        self._create_file_with_n_lines(directory, 2)%0A        self._create_file_with_n_lines(directory, 3)%0A        stat = StatLines(directory)%0A        eq_(5, stat.get_stat())%0A        rmtree(directory)%0A    %0A    def test_proper_number_of_lines_are_counted_in_multiple_dirs(self):%0A        directory = mkdtemp(%22-gb-numlines-multiple-dir-test%22)%0A        inner = mkdtemp(%22-inner-dir%22, dir=directory)%0A        self._create_file_with_n_lines(directory, 2)%0A        self._create_file_with_n_lines(inner, 5)%0A        stat = StatLines(directory)%0A        eq_(7, stat.get_stat())%0A        rmtree(directory)%0A%0A    def test_only_counts_java_files(self):%0A        directory = mkdtemp(%22-gb-numlines-java-files-test%22)%0A        self._create_file_with_n_lines(directory, 2, suffix='.notjava')%0A        self._create_file_with_n_lines(directory, 5
 )%0A  
@@ -1488,33 +1488,33 @@
 ry)%0A        eq_(
-2
+5
 , stat.get_stat(
@@ -1521,30 +1521,338 @@
 ))%0A        rmtree(directory)
+%0A    %0A    @nottest%0A    def _create_file_with_n_lines(self, directory, count, suffix='.java'):%0A        filename = path.join(directory, %22%25s%25s%22 %25 (str(uuid4()), suffix))%0A        with open(filename, %22w%22) as f:%0A            for i in range(1, count+1):%0A                f.write(%22line %25d%5Cn%22 %25 i)%0A            f.close()
 %0A%0A

add more tests to stat_lines_tests