Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

from Map.MapReader import MapReader 

from test import files 

import unittest 

 

class TestReader(unittest.TestCase): 

 

def test_is_loaded(self): 

t1 = MapReader() 

t1.load(files.good) 

 

# test if we have loaded the file 

self.assertFalse(t1.loaded) 

 

def test_is_found(self): 

## test on valid file 

t1 = MapReader() 

t1.load(files.good) 

 

# test if we have loaded the file 

self.assertTrue(t1.file_found) 

 

## test on invalid file 

t2 = MapReader() 

 

# ioerror should be thrown 

with self.assertRaises(IOError): 

t2.load(files.not_real) 

 

# make sure that the file found flag is still false 

self.assertFalse(t2.file_found) 

 

def test_get(self): 

## test if the file found works 

t1 = MapReader() 

t1.load(files.sample) 

result = t1.get() 

 

# check type 

self.assertEquals(type(result), str) 

 

# check if string is valid 

self.assertTrue(result == "sample_string")