from __future__ import unicode_literals

import unittest

from pyaavso.formats.visual import VisualFormatWriter


class VisualFormatWriterTestCase(unittest.TestCase):
    def test_writer_init(self):
        writer = VisualFormatWriter()

from __future__ import unicode_literals

import unittest
from StringIO import StringIO

from pyaavso.formats.visual import VisualFormatWriter


class VisualFormatWriterTestCase(unittest.TestCase):
    """
    Tests for VisualFormatWriter class.
    """
    def test_write_header_obscode(self):
        """
        Check that observer code is written into file.
        """
        fp = StringIO()
        writer = VisualFormatWriter(fp, 'XYZ')
        contents = fp.getvalue()
        self.assertIn("#OBSCODE=XYZ", contents)

Test for obscode in file.
Test for obscode in file.

  from __future__ import unicode_literals
  
  import unittest
+ from StringIO import StringIO
  
  from pyaavso.formats.visual import VisualFormatWriter
  
  
  class VisualFormatWriterTestCase(unittest.TestCase):
+     """
+     Tests for VisualFormatWriter class.
+     """
-     def test_writer_init(self):
+     def test_write_header_obscode(self):
+         """
+         Check that observer code is written into file.
+         """
+         fp = StringIO()
-         writer = VisualFormatWriter()
+         writer = VisualFormatWriter(fp, 'XYZ')
+         contents = fp.getvalue()
+         self.assertIn("#OBSCODE=XYZ", contents)
  
Test for obscode in file.
## Code Before:
from __future__ import unicode_literals

import unittest

from pyaavso.formats.visual import VisualFormatWriter


class VisualFormatWriterTestCase(unittest.TestCase):
    def test_writer_init(self):
        writer = VisualFormatWriter()

## Instruction:
Test for obscode in file.
## Code After:
from __future__ import unicode_literals

import unittest
from StringIO import StringIO

from pyaavso.formats.visual import VisualFormatWriter


class VisualFormatWriterTestCase(unittest.TestCase):
    """
    Tests for VisualFormatWriter class.
    """
    def test_write_header_obscode(self):
        """
        Check that observer code is written into file.
        """
        fp = StringIO()
        writer = VisualFormatWriter(fp, 'XYZ')
        contents = fp.getvalue()
        self.assertIn("#OBSCODE=XYZ", contents)
